Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 8e5ccac

Browse files
committed
Adds permissions to user entity
1 parent 7681066 commit 8e5ccac

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

XF/Entity/User.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,20 @@ class User extends XFCP_User {
88
* @return String[]
99
*/
1010
public function getPermissions() {
11-
return ["this", "is", "a", "test"];
11+
12+
$permissions = [];
13+
14+
foreach ($this->getPermissionSet()->getGlobalPerms() as $group => $group_values) {
15+
foreach($group_values as $permission => $value) {
16+
if ($value == true) {
17+
$permissions[] = $group . "." . $permission;
18+
} elseif ($value) {
19+
$permissions[] = $group . "." . $permission . '.' . $value;
20+
}
21+
}
22+
}
23+
24+
return $permissions;
1225
}
1326

1427
protected function setupApiResultData(

0 commit comments

Comments
 (0)