- Create a role.Create procedureAspnet_roles_createrole (@ applicationnameNvarchar(256), @ rolenameNvarchar(256) The process first calls aspnet_applications_createapplication to register the applicationProgram;
Then, add the role data to the role table (aspnet_roles.Return Value: 0 is returned for success;
The role already exists. 1 is returned.
If an error occurs,-1 is returned.
-
- Deletes a specified role.Create procedureAspnet_roles_deleterole (@ applicationnameNvarchar(256), @ rolenameNvarchar(256), @ deleteonlyifroleisemptyBit)
Input @ deleteonlyifroleisempty to indicate whether the role is only associated with any user
(This role does not exist in the aspnet_usersinroles table ).
Delete a role from the role table (aspnet_roles.
Return Value: 0 is returned for success;
If the application is not registered, 1 is returned;
If the role does not exist, 1 is returned;
Data of the referenced role exists in the aspnet_usersinroles table, and 2 is returned;
- Query (all) Roles and return the role name dataset.
Create procedureAspnet_roles_getallroles (@ applicationnameNvarchar(256 ))
-
- Check whether the role exists.
Create procedureAspnet_roles_roleexists (@ applicationnameNvarchar(256), @ rolenameNvarchar(256) returned value: the role exists, and 1 is returned;
If the role does not exist, 0 is returned.
- add data in batches to the aspnet_usersinroles table.
Create procedure aspnet_usersinroles_adduserstoroles (@ applicationname nvarchar (256), @ usernames nvarchar (4000 ), @ rolenames nvarchar (4000), @ currenttimeutc datetime )
This process associates a batch of users with a batch of specified roles.
If the user does not exist, add the user to the user table (aspnet_users) first.
enter the parameter @ usernames at an interval of ',' .
enter the parameter @ rolenames with the role names separated by ',' .
return value: 0 is returned for success.
2 is returned if the application is not registered.
If a role in @ rolenames does not exist in the role table, 2 is returned;
If any user role combination in @ usernames and @ rolenames
already exists in the aspnet_usersinroles table, 3 is returned.
- batch delete data from the aspnet_usersinroles table. Create procedure aspnet_usersinroles_removeusersfromroles (@ applicationname nvarchar (256 ), @ usernames nvarchar (4000), @ rolenames nvarchar (4000) enter the @ usernames parameter and separate the usernames with ',' .
enter the parameter @ rolenames with the role names separated by ',' .
returned value: 0 is returned for success.
If the application is not registered, 2 is returned;
if a user in @ usernames does not exist in the User table, 1 is returned.
If a role in @ rolenames does not exist in the role table, 2 is returned;
If the combination of @ usernames and @ rolenames does not exist in aspnet_usersinroles, 3 is returned.
- (Like) queries users with a specified role and whose username matches @ usernametomatch, and returns the username dataset.
Create procedureAspnet_usersinroles_findusersinrole (@ applicationnameNvarchar(256), @ rolenameNvarchar(256), @ usernametomatchNvarchar(256) Return Value: 0 is returned successfully;
If the application is not registered, 1 is returned;
The role does not exist. 1 is returned.
-
- Query the user of a specified role and return the user name dataset.Create procedureAspnet_usersinroles_getusersinroles (@ applicationnameNvarchar(256), @ rolenameNvarchar(256 ))
Return Value: 0 is returned for success;
If the application is not registered, 1 is returned;
The role does not exist. 1 is returned.
- Query the role of a specified user and return the role name dataset.Create procedureAspnet_usersinroles_getrolesforuser (@ applicationnameNvarchar(256), @ usernameNvarchar(256 ))
Return Value: 0 is returned for success;
If the application is not registered, 1 is returned;
If the user does not exist, 1 is returned;
-
- Check whether the relevant records in the aspnet_usersinroles table exist.Create procedureAspnet_usersinroles_isuserinrole (@ applicationnameNvarchar(256), @ usernameNvarchar(256), @ rolenameNvarchar(256 ))
Returned value: the application is not registered, and 1 is returned;
If the user does not exist, 2 is returned;
If the role does not exist, 2 is returned;
If the @ username and @ username combinations exist in the aspnet_usersinroles table, 1 is returned;
If it does not exist, 0 is returned.