Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(NFC) CRM_Core_Permission - More docblocks #24043

Merged
merged 1 commit into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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