mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Device group based access (#10568)
* Device group based access * Use Permissions class to resolve permissions Also give port access based on device access * Convert more pages to use Permissions class * shorten config setting name use Eloquent relationships in several places alphabetize config_definitions.json * Change Models and Permissions * Clean up ajax_search LIMIT sql * Convert more pages to use Permissions class Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
@@ -545,13 +545,8 @@ class IRCBot
|
||||
$this->user['level'] = LegacyAuth::get()->getUserlevel($user['username']);
|
||||
$this->user['expire'] = (time() + ($this->config['irc_authtime'] * 3600));
|
||||
if ($this->user['level'] < 5) {
|
||||
foreach (dbFetchRows('SELECT device_id FROM devices_perms WHERE user_id = ?', array($this->user['id'])) as $tmp) {
|
||||
$this->user['devices'][] = $tmp['device_id'];
|
||||
}
|
||||
|
||||
foreach (dbFetchRows('SELECT port_id FROM ports_perms WHERE user_id = ?', array($this->user['id'])) as $tmp) {
|
||||
$this->user['ports'][] = $tmp['port_id'];
|
||||
}
|
||||
$this->user['devices'] = Permissions::devicesForUser($this->user['id'])->toArray();
|
||||
$this->user['ports'] = Permissions::portsForUser($this->user['id'])->toArray();
|
||||
}
|
||||
if ($this->debug) {
|
||||
$this->log("HostAuth on irc for '".$user['username']."', ID: '".$user_id."', Host: '".$host);
|
||||
@@ -581,13 +576,8 @@ class IRCBot
|
||||
$tmp = LegacyAuth::get()->getUserlevel($tmp_user['username']);
|
||||
$this->user['level'] = $tmp;
|
||||
if ($this->user['level'] < 5) {
|
||||
foreach (dbFetchRows('SELECT device_id FROM devices_perms WHERE user_id = ?', array($this->user['id'])) as $tmp) {
|
||||
$this->user['devices'][] = $tmp['device_id'];
|
||||
}
|
||||
|
||||
foreach (dbFetchRows('SELECT port_id FROM ports_perms WHERE user_id = ?', array($this->user['id'])) as $tmp) {
|
||||
$this->user['ports'][] = $tmp['port_id'];
|
||||
}
|
||||
$this->user['devices'] = Permissions::devicesForUser($this->user['id'])->toArray();
|
||||
$this->user['ports'] = Permissions::portsForUser($this->user['id'])->toArray();
|
||||
}
|
||||
|
||||
return $this->respond('Authenticated.');
|
||||
|
Reference in New Issue
Block a user