Skip to end of metadata
Go to start of metadata
You are viewing an old version of this content. View the current version.
Compare with Current
View Version History
« Previous
Version 6
Next »
Bulk Lock Script
UPDATE pv_user
SET locked = True , deleted = True
WHERE
pv_user.id IN (
SELECT A.id
FROM
pv_user A
INNER JOIN pv_user_group_role B ON a.id = B.user_id
WHERE
B.role_id = 1
)
AND
pv_user.id NOT IN (
SELECT X.id
FROM
pv_user X
INNER JOIN pv_user_group_role Y ON X.id = Y.user_id
INNER JOIN pv_group Z ON Y.group_id = Z.id
WHERE
Y.role_id = 1 AND
Z.type_id = 1 AND
(
Z.code LIKE 'S%'
OR
Z.code IN ( 'EDINHF1' , 'RSC02' )
OR
Z.code IN ( 'RMW51' , 'RRBBV' , 'RKHA4' , 'RKGA1' , 'RQBAU' , 'RQHC7' , 'NHSWLS' )
OR
Z.code IN ( '24027' , '2020' , '11023' , '33020' , '7021' , '45021' )
OR
Z.code = 'RQ3'
OR
Z.code = 'RA723'
OR
Z.code = '99RQR13'
OR
Z.code = 'RBS25'
OR
Z.code = 'RP4'
OR
Z.code = 'RW3RM'
OR
Z.code = '99RCSLB'
OR
Z.code = '99RHM01'
OR
Z.code = 'RGQ02'
OR
Z.code IN ( 'RAJ' , 'RAJ01' , 'RQ8L0' , 'RDDH0' )
OR
Z.code IN ( 'RCSLB' , 'RX1CC' )
OR
Z.code = 'REE01'
OR
z.code = 'RH641'
OR
Z.code = 'RMF01'
OR
Z.code = 'SALIBD'
OR
Z.code = 'DSF01'
)
AND
age(now(), date_of_birth) >= '18 years'
)
|
Example Unlock Script
UPDATE pv_user
SET locked = False , deleted = False
WHERE
pv_user.id IN
(
SELECT X.id
FROM
pv_user X
INNER JOIN pv_user_group_role Y ON X.id = Y.user_id
INNER JOIN pv_group Z ON Y.group_id = Z.id
WHERE
Y.role_id = 1 AND
Z.type_id = 1 AND
Z.code IN ( '24027' , '2020' , '11023' , '33020' , '7021' , '45021' )
)
|