| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
class CRM_Core_Permission {
/**
- * Static strings used to compose permissions
+ * Static strings used to compose permissions.
*
* @const
* @var string
const EDIT_GROUPS = 'edit contacts in ', VIEW_GROUPS = 'view contacts in ';
/**
- * The various type of permissions
+ * The various type of permissions.
*
* @var int
*/
const EDIT = 1, VIEW = 2, DELETE = 3, CREATE = 4, SEARCH = 5, ALL = 6, ADMIN = 7;
/**
- * A placeholder permission which always fails
+ * A placeholder permission which always fails.
*/
const ALWAYS_DENY_PERMISSION = "*always deny*";
/**
- * A placeholder permission which always fails
+ * A placeholder permission which always fails.
*/
const ALWAYS_ALLOW_PERMISSION = "*always allow*";
/**
- * Various authentication sources
+ * Various authentication sources.
*
* @var int
*/
const AUTH_SRC_UNKNOWN = 0, AUTH_SRC_CHECKSUM = 1, AUTH_SRC_SITEKEY = 2, AUTH_SRC_LOGIN = 4;
/**
- * Get the current permission of this user
+ * Get the current permission of this user.
*
* @return string
* the permission of the user (edit or view or null)
* Given a permission string or array, check for access requirements
* @param mixed $permissions
* The permission to check as an array or string -see examples.
- * arrays
+ * arrays
*
* Ex 1
*
* array('access CiviEvent', 'access CiviContribute')
* ),
*
- * @return boolean
+ * @return bool
* true if yes, else false
- * @static
*/
public static function check($permissions) {
$permissions = (array) $permissions;
}
/**
- * Determine if any one of the permissions strings applies to current user
+ * Determine if any one of the permissions strings applies to current user.
*
* @param array $perms
* @return bool
* @param array $array
* The group/role to check.
*
- * @return boolean
+ * @return bool
* true if yes, else false
- * @static
*/
public static function checkGroupRole($array) {
$config = CRM_Core_Config::singleton();
}
/**
- * Get the permissioned where clause for the user
+ * Get the permissioned where clause for the user.
*
* @param int $type
* The type of permission needed.
*
* @param string $groupType
* Type of group(Access/Mailing).
- * @param bool|\boolen $excludeHidden exclude hidden groups.
+ * @param bool $excludeHidden
+ * exclude hidden groups.
*
- * @static
*
* @return array
* array reference of all groups.
}
/**
- * Check permissions for delete and edit actions
+ * Check permissions for delete and edit actions.
*
* @param string $module
* Component name.
'export own manual batches' => $prefix . ts('export own manual batches'),
'export all manual batches' => $prefix . ts('export all manual batches'),
'administer payment processors' => $prefix . ts('administer payment processors'),
+ 'edit message templates' => $prefix . ts('edit message templates'),
);
return $permissions;
}
/**
- * Validate user permission across
+ * Validate user permission across.
* edit or view or with supportable acls.
*
- * return boolean true/false.
- **/
+ * @return bool
+ */
public static function giveMeAllACLs() {
if (CRM_Core_Permission::check('view all contacts') ||
CRM_Core_Permission::check('edit all contacts')
*
* @param string $permission
*
- * return string $componentName the name of component.
- *
- * @return int|null|string
- * @static
+ * @return null|string
+ * the name of component.
*/
public static function getComponentName($permission) {
$componentName = NULL;
}
/**
- * Get all the contact emails for users that have a specific permission
+ * Get all the contact emails for users that have a specific permission.
*
* @param string $permissionName
* Name of the permission we are interested in.
}
/**
- * Get all the contact emails for users that have a specific role
+ * Get all the contact emails for users that have a specific role.
*
* @param string $roleName
* Name of the role we are interested in.
'is_enabled'
) ? TRUE : FALSE;
}
+
}