mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-26 22:02:13 +09:00
Remove member directive, and extend auth directive to look at grants
This commit is contained in:
parent
e044e11c5f
commit
d4654eb5cf
3 changed files with 25 additions and 8 deletions
|
|
@ -733,4 +733,22 @@ class Template
|
|||
|
||||
return sprintf(' %s="%s"', $attribute, escape(implode($delimiters[$attribute], $values), false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Auth checker for v2.
|
||||
*
|
||||
* @param string $type
|
||||
* @return bool
|
||||
*/
|
||||
protected function _v2_checkAuth(string $type = 'member'): bool
|
||||
{
|
||||
$grant = \Context::get('grant');
|
||||
switch ($type)
|
||||
{
|
||||
case 'admin': return $this->user->isAdmin();
|
||||
case 'manager': return $grant->manager ?? false;
|
||||
case 'member': return $this->user->isMember();
|
||||
default: return $grant->$type ?? false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue