37 public const CONSTRUCTOR_OPTIONS = [
44 private $groupPermissions;
47 private $revokePermissions;
50 private $groupInheritance;
75 $inheritsFrom = $this->groupInheritance[$group] ?? false;
76 $has = isset( $this->groupPermissions[$group][$permission] ) &&
77 $this->groupPermissions[$group][$permission];
80 if ( !$has && $inheritsFrom !==
false ) {
81 $has = isset( $this->groupPermissions[$inheritsFrom][$permission] ) &&
82 $this->groupPermissions[$inheritsFrom][$permission];
90 $revoked = isset( $this->revokePermissions[$group][$permission] ) &&
91 $this->revokePermissions[$group][$permission];
92 if ( !$revoked && $inheritsFrom !==
false ) {
93 $revoked = isset( $this->revokePermissions[$inheritsFrom][$permission] ) &&
94 $this->revokePermissions[$inheritsFrom][$permission];
111 $rights = array_keys( array_filter( $this->groupPermissions[$group] ?? [] ) );
112 $inheritsFrom = $this->groupInheritance[$group] ??
false;
113 if ( $inheritsFrom !==
false ) {
114 $rights = array_merge(
117 array_keys( array_filter( $this->groupPermissions[$inheritsFrom] ?? [] ) )
121 return array_unique( $rights );
132 $rights = array_keys( array_filter( $this->revokePermissions[$group] ?? [] ) );
133 $inheritsFrom = $this->groupInheritance[$group] ??
false;
134 if ( $inheritsFrom !==
false ) {
135 $rights = array_merge(
138 array_keys( array_filter( $this->revokePermissions[$inheritsFrom] ?? [] ) )
142 return array_unique( $rights );
156 foreach ( $groups as $group ) {
157 $checkGroups[] = $group;
158 if ( isset( $this->groupInheritance[$group] ) ) {
159 $checkGroups[] = $this->groupInheritance[$group];
164 foreach ( $checkGroups as $group ) {
165 if ( isset( $this->groupPermissions[$group] ) ) {
166 $rights = array_merge(
169 array_keys( array_filter( $this->groupPermissions[$group] ) )
174 foreach ( $checkGroups as $group ) {
175 if ( isset( $this->revokePermissions[$group] ) ) {
176 $rights = array_diff(
178 array_keys( array_filter( $this->revokePermissions[$group] ) )
182 return array_unique( $rights );
193 $groups = array_merge(
194 array_keys( $this->groupPermissions ),
195 array_keys( $this->groupInheritance )
197 foreach ( $groups as $group ) {
198 if ( $this->groupHasPermission( $group, $permission ) ) {
199 $allowedGroups[] = $group;
202 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()