Skip to content

Users and Groups

Ian DeRanieri edited this page Feb 8, 2018 · 1 revision

Users

{
  "enabled": 1,
  "archived": 0,
  "locale": "en_us",
  "localeEnabled": true,
  "username": "",
  "firstName": "",
  "lastName": "",
  "email": "",
  "weekStartDay": 0,
  "admin": 1,
  "client": 0,
  "locked": 0,
  "suspended": 0,
  "pending": 0,
  "groups": [
    ""
  ],
  "permissions": [
    ""
  ]
},
Attribute Accepts Notes
enabled Boolean User is enabled.
archived Boolean User is archived.
locale String The handle of the locale.
locale_enabled Boolean Not really sure
username String The user's username.
firstname String The user's first name.
lastname String The user's last name.
email String The user's email address.
weekStartDay Number Accepts 0-6. This is the first day of the user's week. Sunday = 0, etc.
admin Boolean User is admin.
client Boolean User is client.
locked Boolean User is locked.
suspended Boolean User is suspended.
pending Boolean User is pending.
groups Array The handles of the groups this user belongs to.
permissions Array Objects containing the permissions for each section, global, plugin, etc. A json version of the individual permissions in the CP. See the (userGroupPermissions)[] model below for more information.

User Groups

User groups are fairly simple objects.

{
  "name": "",
  "handle": ""
}
Attribute Accepts Notes
name String The name for this user group.
handle String The handle for this user group. If left blank, Craft will automatically generate one.

User Group Permissions

User group permissions are contingent upon what your content and CMS configuration is like. If your site has three sections, you'll need equivalent permissions for each section.

The general format for permissions is: a json array containing the handles of the true permissions, wrapped in an object for that area of the CMS (sections, globals, etc.), wrapped in another object for that userGroup.

UserGroup Object

The main parent object for the userGroupPermissions model. The handle corresponds to the handle given in the userGroup object. The "general" array contains the permissions themselves. If you delete a handle from the model below, the permissions for that field will be set to false.

{
  "handle": "",
  "permissions": {
    "general": [
      "accessCp",
      "accessCpWhenSystemIsOff",
      "accessSiteWhenSystemIsOff",
      "administrateUsers",
      "assignUserPermissions",
      "changeUserEmails",
      "deleteUsers",
      "editUsers",
      "performUpdates",
      "registerUsers"
    ],
    "globals": {

    },
    "assetSources": {

    },
    "sections": {

    },
    "categories": {

    }
  }
}

Globals

The globals object within the userGroupPermissions object accepts arrays, each being declared by the handle of the global set you want to permit the user group to modify.

"yourHandle": [
  "editGlobalSet"
]
Attribute Accepts Notes
editGlobalSet Exists The user group can edit this global set.

Asset Sources

The assetSources object within the userGroupPermissions object accepts arrays, each being declared by the handle of the asset source you want to permit the user group to modify.

"yourHandle": [
  "createSubfoldersInAssetSource",
  "removeFromAssetSource",
  "uploadToAssetSource",
  "viewAssetSource"
]
Attribute Accepts Notes
createSubfoldersInAssetSource Exists User can create subfolders in this asset source.
removeFromAssetSource Exists User can remove assets from this asset source.
uploadToAssetSource Exists User can upload to this asset source.
viewAssetSource Exists User can view this asset source.

Sections

The sections object within the userGroupPermissions object accepts arrays, each being declared by the handle of the section you want to permit the user group to modify. There are two configurations below: one for channels and structures, and one for singles.

"channelOrStructureHandle": [
  "createEntries",
  "deleteEntries",
  "deletePeerEntries",
  "deletePeerEntryDrafts",
  "editEntries",
  "editPeerEntries",
  "editPeerEntryDrafts",
  "publishEntries",
  "publishPeerEntries",
  "publishPeerEntryDrafts"
],
"singlesHandle": [
  "deletePeerEntryDrafts",
  "editEntries",
  "editPeerEntryDrafts",
  "publishEntries",
  "publishPeerEntryDrafts"
],
Attribute Accepts Notes
createEntries Exists The user can create entries in this channel or structure.
deleteEntries Exists The user can delete entries in this channel or structure.
deletePeerEntries Exists The user can delete peer entries in this channel or structure.
deletePeerEntryDrafts Exists The user can delete peer entry drafts in this section.
editEntries Exists The user can edit entries in this section.
editPeerEntries Exists The user can edit peer entries in this channel or structure.
editPeerEntryDrafts Exists The user can edit peer entry drafts in this section.
publishEntries Exists The user can publish entries in this section.
publishPeerEntries Exists The user can publish peer entries in this channel or structure.
publishPeerEntryDrafts Exists The user can publish peer entry drafts in this section.

Categories

The categories object within the userGroupPermissions object accepts arrays, each being declared by the handle of the global set you want to permit the user group to modify.

"yourHandle": [
  "editCategories"
]
Attribute Accepts Notes
editCategories Exists The user group can edit this category.