Changing permissions in bulk
Posted: Mon Jan 03, 2011 7:04 am
Since I can't seem to find a way to set the default permissions, I had the need to change permissions in bulk after a lot of users being added via LDAP.
First step is to figure out what the "role_id" for the role you want is. The easiest way to do this is to have one user with the permission you want (like downoading, for example) and then go to:
(your subsonic URL)/db.view
and type:
select * from user_role
and hit OK.
Find the user that has the permissions you want and figure out what role_id represents the permission you want to grant. Download permissions is '2' ... I haven't spent the time to document them all.
Next step is to actually remove download permissions for everyone. This is to remove duplicate entries. Type this in the db.view window:
delete from user_role where role_id = 2
Finally, we need to add new rows for every user on the system with the number '2' in the second column. This is done like this:
insert into user_role (username, role_id) select username, 2 from user
Hope that helps!
First step is to figure out what the "role_id" for the role you want is. The easiest way to do this is to have one user with the permission you want (like downoading, for example) and then go to:
(your subsonic URL)/db.view
and type:
select * from user_role
and hit OK.
Find the user that has the permissions you want and figure out what role_id represents the permission you want to grant. Download permissions is '2' ... I haven't spent the time to document them all.
Next step is to actually remove download permissions for everyone. This is to remove duplicate entries. Type this in the db.view window:
delete from user_role where role_id = 2
Finally, we need to add new rows for every user on the system with the number '2' in the second column. This is done like this:
insert into user_role (username, role_id) select username, 2 from user
Hope that helps!