SQL Create user Gateway
This commit is contained in:
43
SQL/CreateUser AddToRole.sql
Normal file
43
SQL/CreateUser AddToRole.sql
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
DECLARE @return_value int
|
||||||
|
DECLARE @now datetime
|
||||||
|
declare @utc datetime
|
||||||
|
SET @now = GETDATE()
|
||||||
|
SET @utc = GETUTCDATE()
|
||||||
|
|
||||||
|
DECLARE @user varchar(50)
|
||||||
|
DECLARE @pass varchar(50)
|
||||||
|
DECLARE @role varchar(14)
|
||||||
|
|
||||||
|
SET @user = 'aurel.marjakaj@hotmail.com'-- AdminDobromir
|
||||||
|
SET @pass = 'test1234'
|
||||||
|
SET @role = 'Applicant' -- Applicant,Admin,Company
|
||||||
|
|
||||||
|
|
||||||
|
-- Get Roles: SELECT * FROM aspnet_Roles
|
||||||
|
|
||||||
|
/*Delete USER:
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
DECLARE @UserId uniqueidentifier
|
||||||
|
SET @UserId = (SELECT TOP(1) UserID FROM aspnet_Users
|
||||||
|
WHERE UserName = @user)
|
||||||
|
SELECT @UserId
|
||||||
|
|
||||||
|
DELETE FROM aspnet_Profile WHERE UserID = @UserId
|
||||||
|
DELETE FROM aspnet_UsersInRoles WHERE UserID = @UserId
|
||||||
|
DELETE FROM aspnet_PersonalizationPerUser WHERE UserID = @UserId
|
||||||
|
DELETE FROM dbo.aspnet_Membership WHERE UserID = @UserId
|
||||||
|
DELETE FROM aspnet_users WHERE UserID = @UserId
|
||||||
|
|
||||||
|
|
||||||
|
exec aspnet_Membership_CreateUser '/',@user, @pass, '','no-reply@gateway.one','','',1,@utc,@now,0,0,null
|
||||||
|
|
||||||
|
EXEC [aspnet_UsersInRoles_AddUsersToRoles]
|
||||||
|
@ApplicationName = N'/',
|
||||||
|
@UserNames = @user,
|
||||||
|
@RoleNames = @role,
|
||||||
|
@CurrentTimeUtc = @utc
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user