mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
Display required level in "Not permitted" error message ##2548
This commit is contained in:
parent
bb4cd62e31
commit
b5e9cd9343
2 changed files with 43 additions and 2 deletions
|
|
@ -117,6 +117,39 @@ class PointModel extends Point
|
|||
return $level - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the minimum level required to belong in group(s)
|
||||
*
|
||||
* @param int|array $group_srl
|
||||
* @return ?int
|
||||
*/
|
||||
public static function getMinimumLevelForGroup($group_srl): ?int
|
||||
{
|
||||
if (!is_array($group_srl))
|
||||
{
|
||||
$group_srl = [$group_srl];
|
||||
}
|
||||
|
||||
$min_level = null;
|
||||
$config = self::getConfig();
|
||||
foreach ($config->point_group ?? [] as $group => $required_level)
|
||||
{
|
||||
if (in_array($group, $group_srl))
|
||||
{
|
||||
if ($min_level === null)
|
||||
{
|
||||
$min_level = $required_level;
|
||||
}
|
||||
else
|
||||
{
|
||||
$min_level = min($min_level, $required_level);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $min_level;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue