//Restrict access to a specific page if(!CRM_Core_Permission::check('access CiviMail subscribe/unsubscribe pages')) { CRM_Core_Error::fatal(ts('You do not have permission to access this page.')); }
//Grant access to a specific role $permissions = array( 'access CiviMail subscribe/unsubscribe pages' => CRM_Core_Permission::EDIT, 'access CiviEvent pages' => CRM_Core_Permission::EDIT, ); CRM_Core_Permission::give('my_user_role', $permissions);In this example, the "my_user_role" group is given access to specific pages and actions within the CRM based on the permissions array. By using the CRM_Core_Permission function, developers can ensure that user access is secure and reliable within their CRM system.