Ana içeriğe geç

Introduction

Retrieve information about administrator accounts, their roles and permissions.

For more information about the module's user interface, visit https://doc.oneentry.cloud/docs/category/administrators


🎯 What does this module do?

The Admins module is read-only: it retrieves the administrator accounts of your OneEntry project and their attribute values, with optional filtering. Creating accounts, assigning roles, and revoking access are all done in the OneEntry admin panel — this SDK module only reads that information so your app can see who has access and what they can do.

🚀 Quickstart

Initialize the module from defineOneEntry:


const { Admins } = defineOneEntry(
"your-project-url", {
"token": "your-app-token"
}
);

Retrieve admins, optionally filtered by attribute conditions:

// Filter body: admins whose "num" attribute is greater than 1.
const body = [
{ attributeMarker: "num", conditionMarker: "mth", conditionValue: 1 },
];

// getAdminsInfo(body, langCode, offset, limit) — all optional except defaults.
const admins = await Admins.getAdminsInfo(body, "en_US", 0, 30);

admins.forEach((admin) => {
console.log(admin.id, admin.identifier);
});

Pass an empty array ([]) for the body when you don't need filtering.

✨ Key Concepts

What is an Administrator?

An administrator (admin) is an account with elevated access to manage your OneEntry project. Each admin exposes:

  • Identifier - the admin's unique identifier
  • Attribute set - the attribute set the admin belongs to (attributeSetIdentifier)
  • Attribute values - the configured fields (attributeValues)
  • Roles / permissions - configured in the admin panel; the SDK reads them via attribute values

Administrator vs Regular User

TypePurposeExample
AdministratorManages the system (backend)You, your team members
Regular UserUses your app/website (frontend)Your customers, website visitors

Admins manage content; Users consume content.

📋 What You Need to Know

Admin attributes

Every admin object has these key fields:

{
id: 123, // Unique admin ID
attributeSetId: 27, // Attribute set ID
identifier: "admin", // Unique identifier
attributeSetIdentifier: "admins", // Attribute set identifier
position: 1, // Position
isSync: true, // Whether synced with the backend
attributeValues: {} // Attribute values
}

Filtering admins

Filter through the request body — an array of conditions, each combining an attributeMarker, a conditionMarker, and a conditionValue (same markers as the Products module):

MarkerMeaningExample
eqEqualstatusId = 1 (active only)
neqNot equalrole ≠ "Viewer"
inContains (one of)role in ["Editor", "Manager"]
ninNot containsemail not in ["@temp.com"]
mthMore than (greater)createdYear > 2020
lthLess thanloginCount < 5
exsExists (has value)Has lastLogin
nexsDoes not existNever logged in

📊 Quick Reference Table

MethodDescription
getAdminsInfo()Get admin accounts, with optional filtering

Parameters


const body = [
{
"attributeMarker": "num",
"conditionMarker": "mth",
"conditionValue": 1
}
];

const response = await Admins.getAdminsInfo(body, "en_US", 0, 30);

Schema: (body)

attributeMarker: string
Text identifier attribute
example: price

conditionMarker: string
Text identifier condition, possible values: 'in' - contains, 'nin' - does not contain, 'eq' - equal, 'neq' - not equal, 'mth' - more than, 'lth' - less than, 'exs' - exists, 'nexs' - does not exist
example: in
Enum: [ in, nin, eq, neq, mth, lth, exs, nexs ]

conditionValue: number
Condition value
example: 1

❓ Common Questions (FAQ)

What's the difference between the Admins and Users modules?

  • Admins - backend team accounts that manage the system (read-only here).
  • Users - frontend accounts that use your app/website (Users module).

Can I create or edit admins with this module?

No. The Admins module is read-only. Create accounts, assign roles and permissions, and revoke access in the OneEntry admin panel.


🎓 Best Practices

  • Never expose admin credentials or privileged tokens in frontend code.
  • Use filters to fetch only the admins you need rather than the full list.
  • Implement least privilege when configuring roles in the admin panel.