46 public const CONSTRUCTOR_OPTIONS = [
53 private $groupPermissions;
56 private $revokePermissions;
59 private $groupInheritance;
84 $inheritsFrom = $this->groupInheritance[$group] ?? false;
85 $has = isset( $this->groupPermissions[$group][$permission] ) &&
86 $this->groupPermissions[$group][$permission];
89 if ( !$has && $inheritsFrom !==
false ) {
90 $has = isset( $this->groupPermissions[$inheritsFrom][$permission] ) &&
91 $this->groupPermissions[$inheritsFrom][$permission];
99 $revoked = isset( $this->revokePermissions[$group][$permission] ) &&
100 $this->revokePermissions[$group][$permission];
101 if ( !$revoked && $inheritsFrom !==
false ) {
102 $revoked = isset( $this->revokePermissions[$inheritsFrom][$permission] ) &&
103 $this->revokePermissions[$inheritsFrom][$permission];
120 $rights = array_keys( array_filter( $this->groupPermissions[$group] ?? [] ) );
121 $inheritsFrom = $this->groupInheritance[$group] ??
false;
122 if ( $inheritsFrom !==
false ) {
123 $rights = array_merge(
126 array_keys( array_filter( $this->groupPermissions[$inheritsFrom] ?? [] ) )
130 return array_unique( $rights );
141 $rights = array_keys( array_filter( $this->revokePermissions[$group] ?? [] ) );
142 $inheritsFrom = $this->groupInheritance[$group] ??
false;
143 if ( $inheritsFrom !==
false ) {
144 $rights = array_merge(
147 array_keys( array_filter( $this->revokePermissions[$inheritsFrom] ?? [] ) )
151 return array_unique( $rights );
168 foreach ( $groups as $group ) {
169 $checkGroups[] = $group;
170 if ( isset( $this->groupInheritance[$group] ) ) {
171 $checkGroups[] = $this->groupInheritance[$group];
176 foreach ( $checkGroups as $group ) {
177 if ( isset( $this->groupPermissions[$group] ) ) {
178 $rights = array_merge(
181 array_keys( array_filter( $this->groupPermissions[$group] ) )
186 foreach ( $checkGroups as $group ) {
187 if ( isset( $this->revokePermissions[$group] ) ) {
188 $rights = array_diff(
190 array_keys( array_filter( $this->revokePermissions[$group] ) )
194 return array_unique( $rights );
205 $groups = array_unique( array_merge(
206 array_keys( $this->groupPermissions ),
207 array_keys( $this->groupInheritance )
209 foreach ( $groups as $group ) {
210 if ( $this->groupHasPermission( $group, $permission ) ) {
211 $allowedGroups[] = $group;
214 return $allowedGroups;
A class containing constants representing the names of configuration variables.
const GroupInheritsPermissions
Name constant for the GroupInheritsPermissions setting, for use with Config::get()
const RevokePermissions
Name constant for the RevokePermissions setting, for use with Config::get()
const GroupPermissions
Name constant for the GroupPermissions setting, for use with Config::get()