mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-27 04:08:57 +02:00
Reset the permissions of the admin user.
This commit is contained in:
parent
f8aee65d9e
commit
10a035fcea
3 changed files with 11 additions and 3 deletions
|
@ -168,7 +168,7 @@ perms: # Here comes a list with all Permission names (they have a perm_[name] co
|
|||
label: "perm.show_history"
|
||||
revert_element:
|
||||
label: "perm.revert_elements"
|
||||
alsoSet: ["read", "create", "delete", "edit_permissions", "show_history", "edit_infos", "change_group", "edit_username"]
|
||||
alsoSet: ["read", "create", "delete", "edit_permissions", "show_history", "edit_infos", "edit_username"]
|
||||
|
||||
#database:
|
||||
# label: "perm.database"
|
||||
|
|
|
@ -20,8 +20,16 @@ final class Version20221031195841 extends AbstractMigration
|
|||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE groups ADD permissions_data LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\'');
|
||||
$this->addSql('ALTER TABLE `groups` ADD permissions_data LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\'');
|
||||
$this->addSql('ALTER TABLE users ADD permissions_data LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\'');
|
||||
|
||||
//Set permissions of the admin user to allow all permissions
|
||||
$this->addSql(<<<'SQL'
|
||||
UPDATE `users` SET permissions_data = '{"parts":{"read":true,"edit":true,"create":true,"delete":true,"change_favorite":true,"show_history":true,"revert_element":true},"storelocations":{"read":true,"edit":true,"create":true,"delete":true,"show_history":true,"revert_element":true},"footprints":{"read":true,"edit":true,"create":true,"delete":true,"show_history":true,"revert_element":true},"categories":{"read":true,"edit":true,"create":true,"delete":true,"show_history":true,"revert_element":true},"suppliers":{"read":true,"edit":true,"create":true,"delete":true,"show_history":true,"revert_element":true},"manufacturers":{"read":true,"edit":true,"create":true,"delete":true,"show_history":true,"revert_element":true},"tools":{"statistics":true,"lastActivity":true,"timetravel":true,"label_scanner":true,"reel_calculator":true},"self":{"edit_infos":true,"edit_username":true,"show_permissions":true,"show_logs":true},"labels":{"create_labels":true,"edit_options":true,"read_profiles":true,"edit_profiles":true,"create_profiles":true,"delete_profiles":true,"use_twig":true,"show_history":true,"revert_element":true},"groups":{"read":true,"edit":true,"create":true,"delete":true,"edit_permissions":true,"show_history":true,"revert_element":true},"users":{"read":true,"create":true,"delete":true,"edit_username":true,"edit_infos":true,"edit_permissions":true,"set_password":true,"change_user_settings":true,"show_history":true,"revert_element":true},"system":{"show_logs":true,"delete_logs":true},"devices":{"read":true,"edit":true,"create":true,"delete":true,"show_history":true,"revert_element":true},"attachment_types":{"read":true,"edit":true,"create":true,"delete":true,"show_history":true,"revert_element":true},"currencies":{"read":true,"edit":true,"create":true,"delete":true,"show_history":true,"revert_element":true},"measurement_units":{"read":true,"edit":true,"create":true,"delete":true,"show_history":true,"revert_element":true}}'
|
||||
WHERE id = 2;
|
||||
SQL);
|
||||
|
||||
$this->warnIf(true, "\x1b[1;37;43m\n!!! All permissions were reset! Please change them to the desired state, immediately !!!\n\x1b[0;39;49m");
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
|
|
|
@ -151,7 +151,7 @@ class PermissionResolver
|
|||
|
||||
//Check if the permission/operation combination is valid
|
||||
if (! $this->isValidOperation($permission, $operation)) {
|
||||
throw new InvalidArgumentException('The permission/operation combination is not valid!');
|
||||
throw new InvalidArgumentException(sprintf('The permission/operation combination "%s.%s" is not valid!', $permission, $operation));
|
||||
}
|
||||
|
||||
$perm_list->setPermissionValue($permission, $operation, $new_val);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue