Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
2| Name | Data Type | Length | Description |
|---|---|---|---|
| @userID | int | 4 | |
| @dbaction | varchar | 11 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE OR ALTER PROCEDURE dbo.user_login_expiration
@userID int,
@dbaction varchar(11)
AS
BEGIN
SET NOCOUNT ON;
/*STORED PROCEDURE DE MANTENIMIENTO DE USUARIOS
TRES POSIBLES ACCIONES
1--> END_SESSION para finalizar las sesiones del usuario requerido
2--> EXPIRE_PWD para expirar la clave del usuario y forzarlo a cambiarla
3--> EXPIRE_USER para inhabilitar el usuario
4--> ACTIVE_USER para rehabilitar el usuario
*/
if (upper(@dbaction) = 'END_SESSION') /* FINALIZAMOS LA SESION */
BEGIN
update users set login_state = '',last_access = getdate()-0.231
where user_id = @userID
END
if (upper(@dbaction) = 'EXPIRE_PWD') /* EXPIRAMOS LA CLAVE DEL USUARIO */
BEGIN
update users set login_state = '',login_expiration = getdate()-0.231
where user_id = @userID
update users_enc_pwd set active = 0 where user_id = @UserID and active = 1
END
if (upper(@dbaction) = 'EXPIRE_USER') /* INHABILITAMOS EL USUARIO */
BEGIN
update users set login_state = '',login_expiration = getdate()-0.231,active_user = 'N'
where user_id = @userID
update users_enc_pwd set active = 0 where user_id = @UserID and active = 1
END
if (upper(@dbaction) = 'ACTIVE_USER') /* REHABILITAMOS EL USUARIO */
BEGIN
update users set login_state = '',login_expiration = getdate()-0.231,active_user = 'Y'
where user_id = @userID
update users_enc_pwd set active = 0 where user_id = @UserID and active = 1
END
/* devolvemos los datos */
SELECT @UserID as userid
END
/* STORED PROCEDURE DE LOGIN DE USUARIOS Y CAMBIO DE CLAVES */
SET ANSI_NULLS ON
GO
GO
CREATE OR ALTER PROCEDURE dbo.user_login_expiration
@userID int,
@dbaction varchar(11)
AS
BEGIN
SET NOCOUNT ON;
/*STORED PROCEDURE DE MANTENIMIENTO DE USUARIOS
TRES POSIBLES ACCIONES
1--> END_SESSION para finalizar las sesiones del usuario requerido
2--> EXPIRE_PWD para expirar la clave del usuario y forzarlo a cambiarla
3--> EXPIRE_USER para inhabilitar el usuario
4--> ACTIVE_USER para rehabilitar el usuario
*/
if (upper(@dbaction) = 'END_SESSION') /* FINALIZAMOS LA SESION */
BEGIN
update users set login_state = '',last_access = getdate()-0.231
where user_id = @userID
END
if (upper(@dbaction) = 'EXPIRE_PWD') /* EXPIRAMOS LA CLAVE DEL USUARIO */
BEGIN
update users set login_state = '',login_expiration = getdate()-0.231
where user_id = @userID
update users_enc_pwd set active = 0 where user_id = @UserID and active = 1
END
if (upper(@dbaction) = 'EXPIRE_USER') /* INHABILITAMOS EL USUARIO */
BEGIN
update users set login_state = '',login_expiration = getdate()-0.231,active_user = 'N'
where user_id = @userID
update users_enc_pwd set active = 0 where user_id = @UserID and active = 1
END
if (upper(@dbaction) = 'ACTIVE_USER') /* REHABILITAMOS EL USUARIO */
BEGIN
update users set login_state = '',login_expiration = getdate()-0.231,active_user = 'Y'
where user_id = @userID
update users_enc_pwd set active = 0 where user_id = @UserID and active = 1
END
/* devolvemos los datos */
SELECT @UserID as userid
END
/* STORED PROCEDURE DE LOGIN DE USUARIOS Y CAMBIO DE CLAVES */
SET ANSI_NULLS ON
GO
Depends On
2Used By
No items found