Skip to content

Commit

Permalink
Adds permissions to user entity
Browse files Browse the repository at this point in the history
  • Loading branch information
AshCorr committed Oct 6, 2020
1 parent 7681066 commit 8e5ccac
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion XF/Entity/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,20 @@ class User extends XFCP_User {
* @return String[]
*/
public function getPermissions() {
return ["this", "is", "a", "test"];

$permissions = [];

foreach ($this->getPermissionSet()->getGlobalPerms() as $group => $group_values) {
foreach($group_values as $permission => $value) {
if ($value == true) {
$permissions[] = $group . "." . $permission;
} elseif ($value) {
$permissions[] = $group . "." . $permission . '.' . $value;
}
}
}

return $permissions;
}

protected function setupApiResultData(
Expand Down

0 comments on commit 8e5ccac

Please sign in to comment.