mirror of
https://github.com/flarum/core.git
synced 2025-07-25 18:51:40 +02:00
Implement hidden permission groups (#2129)
Only users that have the new `viewHiddenGroups` permissions will be able to see these groups. You might want this when you want to give certain users special permissions, but don't want to make your authorization scheme public to regular users. Co-authored-by: luceos <daniel+github@klabbers.email>
This commit is contained in:
committed by
GitHub
parent
df8f73bd3d
commit
6e8884f190
@@ -45,6 +45,10 @@ class BasicUserSerializer extends AbstractSerializer
|
||||
*/
|
||||
protected function groups($user)
|
||||
{
|
||||
return $this->hasMany($user, GroupSerializer::class);
|
||||
if ($this->getActor()->can('viewHiddenGroups')) {
|
||||
return $this->hasMany($user, GroupSerializer::class);
|
||||
}
|
||||
|
||||
return $this->hasMany($user, GroupSerializer::class, 'visibleGroups');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user