mirror of
https://github.com/flarum/core.git
synced 2025-10-13 16:05:05 +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
@@ -23,6 +23,7 @@ use Flarum\User\User;
|
||||
* @property string $name_plural
|
||||
* @property string|null $color
|
||||
* @property string|null $icon
|
||||
* @property bool $is_hidden
|
||||
* @property \Illuminate\Database\Eloquent\Collection $users
|
||||
* @property \Illuminate\Database\Eloquent\Collection $permissions
|
||||
*/
|
||||
@@ -72,9 +73,10 @@ class Group extends AbstractModel
|
||||
* @param string $namePlural
|
||||
* @param string $color
|
||||
* @param string $icon
|
||||
* @param bool $isHidden
|
||||
* @return static
|
||||
*/
|
||||
public static function build($nameSingular, $namePlural, $color, $icon)
|
||||
public static function build($nameSingular, $namePlural, $color = null, $icon = null, bool $isHidden = false): self
|
||||
{
|
||||
$group = new static;
|
||||
|
||||
@@ -82,6 +84,7 @@ class Group extends AbstractModel
|
||||
$group->name_plural = $namePlural;
|
||||
$group->color = $color;
|
||||
$group->icon = $icon;
|
||||
$group->is_hidden = $isHidden;
|
||||
|
||||
$group->raise(new Created($group));
|
||||
|
||||
|
Reference in New Issue
Block a user