SQL Create user Gateway

This commit is contained in:
Dobromir Popov
2025-08-08 15:04:11 +03:00
parent 7a4cf4efbd
commit d7c1a30cdb

View 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