Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Ravada-Mirror
Commits
f4fac0fa
Commit
f4fac0fa
authored
May 10, 2017
by
Francesc Guasch
Browse files
[#222] grant minimal permissions for old users
parent
f8903f5e
Changes
3
Hide whitespace changes
Inline
Side-by-side
lib/Ravada.pm
View file @
f4fac0fa
...
...
@@ -105,6 +105,18 @@ sub BUILD {
$self
->
_update_data
();
}
sub
_update_user_grants
{
my
$self
=
shift
;
my
$sth
=
$CONNECTOR
->
dbh
->
prepare
("
SELECT id FROM users
");
my
$id
;
$sth
->
bind_columns
(
\
$id
);
$sth
->
execute
;
while
(
$sth
->
fetch
)
{
my
$user
=
Ravada::Auth::
SQL
->
search_by_id
(
$id
);
}
$sth
->
finish
;
}
sub
_update_isos
{
my
$self
=
shift
;
my
$table
=
'
iso_images
';
...
...
@@ -161,6 +173,7 @@ sub _update_isos {
sub
_update_data
{
my
$self
=
shift
;
$self
->
_update_isos
();
$self
->
_update_user_grants
();
}
sub
_upgrade_table
{
...
...
lib/Ravada/Auth/SQL.pm
View file @
f4fac0fa
...
...
@@ -390,8 +390,6 @@ sub _load_grants($self) {
$self
->
{
_grant
}
->
{
$name
}
=
(
$allowed
or
0
);
}
$sth
->
finish
;
$self
->
grant_user_permissions
(
$self
);
}
sub
grant_user_permissions
($self,$user) {
...
...
t/user/20_grants.t
View file @
f4fac0fa
...
...
@@ -24,6 +24,7 @@ init($test->connector);
sub
test_defaults
{
my
$user
=
create_user
("
foo
","
bar
");
my
$rvd_back
=
rvd_back
();
ok
(
$user
->
can_clone
);
ok
(
$user
->
can_change_settings
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment