mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 03:01:43 +09:00
Add not_member option to grant selection #2499
This commit is contained in:
parent
c89af17410
commit
8e151d7cfa
7 changed files with 38 additions and 23 deletions
|
|
@ -37,7 +37,7 @@ class Permission
|
|||
$member_groups = !empty($member_info->group_list) ? array_keys($member_info->group_list) : [];
|
||||
|
||||
// Generate the list of default permissions.
|
||||
$defaults = [
|
||||
$this->_spec = [
|
||||
'access' => '',
|
||||
'root' => 'root',
|
||||
'manager' => 'manager',
|
||||
|
|
@ -46,11 +46,10 @@ class Permission
|
|||
];
|
||||
foreach ($xml_grant_list as $key => $val)
|
||||
{
|
||||
$defaults[$key] = $val->default ?? '';
|
||||
$this->_spec[$key] = $val->default ?? '';
|
||||
}
|
||||
|
||||
// Generate the combined spec for this module.
|
||||
$this->_spec = $defaults;
|
||||
// Override the defaults with user settings.
|
||||
foreach ($module_grants as $row)
|
||||
{
|
||||
$key = $row->name;
|
||||
|
|
@ -64,6 +63,11 @@ class Permission
|
|||
$this->_spec[$key] = 'member';
|
||||
continue;
|
||||
}
|
||||
if ($row->group_srl == -4)
|
||||
{
|
||||
$this->_spec[$key] = 'not_member';
|
||||
continue;
|
||||
}
|
||||
if ($row->group_srl == -3)
|
||||
{
|
||||
$this->_spec[$key] = 'manager';
|
||||
|
|
@ -90,19 +94,15 @@ class Permission
|
|||
if ($member_info && $member_info->is_admin === 'Y')
|
||||
{
|
||||
$this->_scopes = true;
|
||||
foreach ($defaults as $key => $default)
|
||||
foreach ($this->_spec as $key => $requirement)
|
||||
{
|
||||
$this->{$key} = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
elseif ($is_module_admin)
|
||||
if ($is_module_admin)
|
||||
{
|
||||
$this->_scopes = $is_module_admin;
|
||||
foreach ($defaults as $key => $default)
|
||||
{
|
||||
$this->{$key} = ($default !== 'root');
|
||||
}
|
||||
}
|
||||
|
||||
// Check if each permission is granted to the current user.
|
||||
|
|
@ -116,6 +116,10 @@ class Permission
|
|||
{
|
||||
$this->{$key} = ($member_info && $member_info->member_srl);
|
||||
}
|
||||
elseif ($requirement === 'not_member')
|
||||
{
|
||||
$this->{$key} = !($member_info && $member_info->member_srl);
|
||||
}
|
||||
elseif ($requirement === 'manager')
|
||||
{
|
||||
$this->{$key} = $this->manager ? true : false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue