Files
librenms-librenms/LibreNMS/Enum/LegacyAuthLevel.php
Tony Murray 2cd207028a Implement RBAC (only built in roles) (#15212)
* Install bouncer

* Seeder and level migration

* Display and edit roles

* remove unused deluser page

* Update Radius and SSO to assign roles

* update AlertUtil direct level check to use roles instead

* rewrite ircbot auth handling

* Remove legacy auth getUserlist and getUserlevel methods, add getRoles
Set roles in LegacyUserProvider

* Small cleanups

* centralize role sync code
show roles on user preferences page

* VueSelect component WIP and a little docs

* WIP

* SelectControllers id and text fields.

* LibrenmsSelect component extracted from SettingSelectDynamic

* Handle multiple selections

* allow type coercion

* full width settings

* final style adjustments

* Final compiled assets update

* Style fixes

* Fix SSO tests

* Lint cleanups

* small style fix

* don't use json yet

* Update baseline for usptream package issues

* Change schema, not 100% sure it is correct
not sure why xor doesn't work
2023-08-28 00:13:40 -05:00

32 lines
682 B
PHP

<?php
namespace LibreNMS\Enum;
enum LegacyAuthLevel: int
{
case user = 1;
case global_read = 5;
case admin = 10;
case demo = 11;
public function fromName(string $name): ?LegacyAuthLevel
{
return match ($name) {
'admin' => LegacyAuthLevel::admin,
'user' => LegacyAuthLevel::user,
'global-read', 'global_read' => LegacyAuthLevel::global_read,
'demo' => LegacyAuthLevel::demo,
default => null
};
}
public function getName(): string
{
if ($this == LegacyAuthLevel::global_read) {
return 'global-read';
}
return $this->name;
}
}