Reply To: Check if admin or not / custom permissions

We're upgrading our support forum. Replies are currently closed. Please view our Documentation and FAQ using the menu above.

The UCM system doesn’t really know between “admin” or “non-admin”. It is all based on individual permissions.

eg: Can the current user view the customer listing?
if(module_customer::can_i(‘view’,’Customers’)){ …

eg: Can the current user create a new customer?
if(module_customer::can_i(‘create’,’Customers’)){ …

eg: Can the current user view the Config Settings area of UCM?
if(module_config::can_i(‘view’,’Settings’)){ …

eg: Can the current user create new system users?
if(module_user::can_i(‘create’,’Users’,’Config’)){ …

have a hunt through the code for any other can_i bits if you need further examples.

There’s also another can_user call, which checks those individual tickboxes in the User Role area on the right, eg:

module_security::can_user(module_security::get_loggedin_id(),’Show Quick Search’)
module_security::can_user(module_security::get_loggedin_id(),’Can User Login’)

You can even create your own, and it will show up in a tickbox in User Roles, eg:

module_security::can_user(module_security::get_loggedin_id(),’My Custom Permission’)

Good luck!
dtbaker

dtbakerReply To: Check if admin or not / custom permissions