mirror of https://github.com/MISP/MISP
chg: [roles] set default role to User if none is set
parent
e96c56ef94
commit
bdda94529d
|
@ -1661,4 +1661,6 @@ INSERT IGNORE INTO `org_blocklists` (`org_uuid`, `created`, `org_name`, `comment
|
|||
('58d38339-7b24-4386-b4b4-4c0f950d210f', NOW(), 'Setec Astrononomy', 'default example'),
|
||||
('58d38326-eda8-443a-9fa8-4e12950d210f', NOW(), 'Acme Finance', 'default example');
|
||||
|
||||
INSERT IGNORE INTO `admin_settings` (`setting`, `value`) VALUES ('fix_login', NOW());
|
||||
INSERT IGNORE INTO `admin_settings` (`setting`, `value`) VALUES
|
||||
('fix_login', NOW()),
|
||||
('default_role', 3);
|
|
@ -84,6 +84,7 @@ class AppModel extends Model
|
|||
87 => false, 88 => false, 89 => false, 90 => false, 91 => false, 92 => false,
|
||||
93 => false, 94 => false, 95 => true, 96 => false, 97 => true, 98 => false,
|
||||
99 => false, 100 => false, 101 => false, 102 => false, 103 => false, 104 => false,
|
||||
105 => false
|
||||
);
|
||||
|
||||
const ADVANCED_UPDATES_DESCRIPTION = array(
|
||||
|
@ -1929,6 +1930,17 @@ class AppModel extends Model
|
|||
case 104:
|
||||
$sqlArray[] = "ALTER TABLE `access_logs` ADD `query_log` blob DEFAULT NULL";
|
||||
break;
|
||||
case 105:
|
||||
// set a default role if there is none
|
||||
if (!$this->AdminSetting->getSetting('default_role')) {
|
||||
$role = $this->Role->findByName('User');
|
||||
if ($role) {
|
||||
$sqlArray[] = "INSERT INTO `admin_settings` (setting, value) VALUES ('default_role', '".$role['Role']['id']."');";
|
||||
} else {
|
||||
// there is no role called User, do nothing
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'fixNonEmptySharingGroupID':
|
||||
$sqlArray[] = 'UPDATE `events` SET `sharing_group_id` = 0 WHERE `distribution` != 4;';
|
||||
$sqlArray[] = 'UPDATE `attributes` SET `sharing_group_id` = 0 WHERE `distribution` != 4;';
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
);
|
||||
$table_data[] = array('key' => __('Role'), 'html' => $this->Html->link($user['Role']['name'], array('controller' => 'roles', 'action' => 'view', $user['Role']['id'])));
|
||||
$table_data[] = array('key' => __('Event alert enabled'), 'boolean' => $user['User']['autoalert']);
|
||||
$table_data[] = ['key' => __('Periodic Notifications'), 'html' => $periodic_notification_settings_html];
|
||||
$table_data[] = array('key' => __('Periodic Notifications'), 'html' => $periodic_notification_settings_html);
|
||||
$table_data[] = array('key' => __('Contact alert enabled'), 'boolean' => $user['User']['contactalert']);
|
||||
|
||||
if (!$admin_view && !$user['Role']['perm_auth']) {
|
||||
|
@ -160,4 +160,6 @@
|
|||
'admin_view' => ['menuList' => 'admin', 'menuItem' => 'viewUser'],
|
||||
'view' => ['menuList' => 'globalActions', 'menuItem' => 'view']
|
||||
];
|
||||
?>
|
||||
<?php
|
||||
echo $this->element('/genericElements/SideMenu/side_menu', $current_menu[$admin_view ? 'admin_view' : 'view']);
|
||||
|
|
Loading…
Reference in New Issue