User permissions

CMS sets the following variables to check user permissions:

  • {$user} - boolean, if true (1) then user has logged in.
  • {$in_editor} - boolean, if true (1) then user is logged in and is located in the editor-area and this user has also (C)reate, (U)pdate or (D)delete permissions for the current section.

In addition, every object has their permissions in the "permission" array, these permissions are calculated for the current logged in user:

  • {$obj->permission.C} - boolean, if true (1) then the user has C(reate) permission for this object.
  • {$obj->permission.R} - boolean, if true (1) then the user has R(ead) permission for this object.
  • {$obj->permission.U} - boolean, if true (1) then the user has U(pdate) permission for this object.
  • {$obj->permission.P} - boolean, if true (1) then the user has P(ublish) permission for this object.
  • {$obj->permission.D} - boolean, if true (1) then the user has D(elete) permission for this object.
  • {$obj->permission.only_read} - boolean, if true (1) then the user has only R(ead) permission for this object.
  • {$obj->permission.is_visible} - boolean, if true (1) then the object is visible to the user.
  • {$obj->permission.mask} - the CRUPD permissions mask in 5 digit format eg "01110".

Example

Display custom action link in the editor area for editors having Create or Update permission for this content object

{if $in_editor && ($obj->permission.C || $obj->permission.U) }
# .. display action link ..
{/if}