* a permission name
*/
public function translatePermission($perm, $nativePrefix, $map) {
- list ($civiPrefix, $name) = CRM_Utils_String::parsePrefix(':', $perm, NULL);
+ [$civiPrefix, $name] = CRM_Utils_String::parsePrefix(':', $perm, NULL);
switch ($civiPrefix) {
case $nativePrefix:
return $name;
}
/**
- * Get the current permission of this user.
+ * Get the maximum permission of the current user with respect to _any_ contact records.
*
- * @return string
- * the permission of the user (edit or view or null)
+ * @return int|string|null
+ * @see \CRM_Core_Permission::getPermission()
*/
public function getPermission() {
$this->group();
* The permission to check.
* @param int $userId
*
+ * @return bool;
+ *
*/
public function check($str, $userId = NULL) {
//no default behaviour
+ return FALSE;
}
/**
* Array of permissions, in the same format as CRM_Core_Permission::getCorePermissions().
* @see CRM_Core_Permission::getCorePermissions
*/
- public static function getModulePermissions($module) {
+ public function getModulePermissions($module): array {
$return_permissions = [];
$fn_name = "{$module}_civicrm_permission";
if (function_exists($fn_name)) {
* @return array
* Array of permissions, in the same format as CRM_Core_Permission::getCorePermissions().
*/
- public function getAllModulePermissions($descriptions = FALSE) {
- // Passing in false here is to be deprecated.
+ public function getAllModulePermissions($descriptions = FALSE): array {
$permissions = [];
CRM_Utils_Hook::permission($permissions);
}
}
else {
+ // Passing in false here is to be deprecated.
foreach ($permissions as $permission => $label) {
$permissions[$permission] = (is_array($label)) ? array_shift($label) : $label;
}