Skip to content

Commit

Permalink
Merge pull request #24043 from totten/master-nfc-perm
Browse files Browse the repository at this point in the history
(NFC) CRM_Core_Permission - More docblocks
  • Loading branch information
demeritcowboy authored Jul 22, 2022
2 parents 0c604bb + 75840ae commit d97227c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
15 changes: 12 additions & 3 deletions CRM/Core/Permission.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,19 @@ class CRM_Core_Permission {
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 maximum permission of the current user with respect to _any_ contact records.
*
* @return string
* the permission of the user (edit or view or null)
* Note: This appears to be hydrated via `CRM_Core_Permission*::group()`, which appears to run in
* many page-views, but I'm not certain that it's guaranteed.
*
* @return int|string|null
* Highest permission held by the current user.
* If the user has "edit" rights to at least 1 contact (via permission or ACL),
* then CRM_Core_Permission::EDIT.
* If the user has "view" rights to at least 1 contact (via permission or ACL),
* then CRM_Core_Permission::VIEW.
* Otherwise, NULL.
* @see \CRM_Core_Permission_Base::group()
*/
public static function getPermission() {
$config = CRM_Core_Config::singleton();
Expand Down
6 changes: 3 additions & 3 deletions CRM/Core/Permission/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ public function translatePermission($perm, $nativePrefix, $map) {
}

/**
* 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();
Expand Down

0 comments on commit d97227c

Please sign in to comment.