Reputation:
How can I copy all the existing Sybase user's permissions to a new account? For example, some tables only have select permission, many procs have execute permission, etc. The original account had limited access to a couple dozen tables and several stored procs, out of hundreds of database objects.
Upvotes: 0
Views: 2869
Reputation: 119
If you are going to do this multiple times: Create a role, grant permissions to the role, and assign users to that role.
If auditing who is doing what in the database is not critical: Alias the new user to the old user in the database
sp_dropuser 'NEW_USERNAME'
go
sp_addalias 'NEW_USERNAME', 'EXISTING_USERNAME'
go
sp_helprotect EXISTING_USERNAME will print out a list of permissions for that user. You can capture that output and use it to add those permissions to a new account.
The following steps require editing system tables, be vary careful to avoid breaking your system. Ensure you have good backups. *
User permissions are stored in the sysprotects table. In theory you should be able to:
DISCLAIMER Please test this before trying it on a production server, as I have not tested this to verify it works.
Upvotes: 1