Changing permissions in bulk

Tutorials, tips and tricks.

Moderator: moderators

Changing permissions in bulk

Postby pkx » 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!
Posts: 7
Joined: Sat Jan 01, 2011 9:09 pm
Location: United States

Re: Changing permissions in bulk

Postby probie » Fri Jan 25, 2013 4:49 pm

Does any know the setting for this. I want to make new user the ave the ability to download file as default.
Posts: 7
Joined: Thu Nov 01, 2012 11:47 pm

Return to Tutorials

Who is online

Users browsing this forum: No registered users and 3 guests