Skip to content

Commit b33a8ac

Browse files
committed
When checking to see if a user has access based on their role, if they have no roles set on a site but they are a super admin, set their role to administrator
1 parent 0180001 commit b33a8ac

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

includes/Classifai/Features/Feature.php

+5
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,11 @@ public function has_access(): bool {
938938
* Checks if Role-based access is enabled and user role has access to the feature.
939939
*/
940940
if ( $role_based_access_enabled ) {
941+
// For super admins that don't have a specific role on a site, treat them as admins.
942+
if ( is_multisite() && is_super_admin( $user_id ) && empty( $user_roles ) ) {
943+
$user_roles = [ 'administrator' ];
944+
}
945+
941946
$access = ( ! empty( $feature_roles ) && ! empty( array_intersect( $user_roles, $feature_roles ) ) );
942947
}
943948

0 commit comments

Comments
 (0)