We can grant role in Sybase using grant command and sp_role procedure. We can revoke the roles granted to login. But, we cannot revoke the role from a login when it is currently logged in.
Syntax:
sp_role {“grant” | “revoke”} , role_name, login_name
Syntax:
grant role role_name [, role_name … ] to grantee [, grantee …] revoke role role_name [, role_name … ] from grantee [, grantee …]
Examples:
1. Grant sso_role to user ‘test’ in Sybase.
sp_role “grant”,sso_role,test go or grant role sso_role to test go
2. To revoke role from login ‘test’
sp_role “revoke”,sso_role,test go or revoke role sso_role to test go
To know the roles granted to login run sp_displaylogin ‘test’. We can find the roles information of login with the parameter Configured Authorization.
Suid: 4
Loginame: test
Fullname:
Default Database: master
Default Language:
Auto Login Script:
Configured Authorization:
sso_role (default ON)
Locked: NO
Date of Last Password Change: Aug 28 2018 9:43PM
Password expiration interval: 0
Password expired: NO
Minimum password length: 6
Maximum failed logins: 0
Current failed login attempts: 0
Authenticate with: AUTH_DEFAULT
Login Password Encryption: SHA-256
Last login date:
Exempt inactive lock: 0
(return status = 0)