/ *
API for processing related to standard users.
* /
---API related to user processing
FND_USER_PKG
---API related to user password processing
Fnd_web_sec
---API related to user responsibility handling
FND_USER_RESP_GROUPS_API
-----------------------------
---Process instance
-----------------------------
SELECT * FROM FND_USER WHERE USER_NAME = ‘WX214492‘
---Update user, invalidate user:
DECLARE
BEGIN
FND_USER_PKG.UpdateUser
(
x_user_name => ‘WX214492‘
,x_owner => NULL
,x_end_date => SYSDATE
);
--It is OK to use the following. In fact, the same process is called.
--FND_USER_PKG.DisableUser(‘WX214492‘);
END;
--Batch invalid users:
DECLARE
CURSOR CUR_DISABLE_USER
IS
SELECT USER_NAME
FROM FND_USER
WHERE USER_NAME IN (‘‘);
L_DEAL_COUNT NUMBER;
BEGIN
L_DEAL_COUNT := 0;
FOR REC_DISABLE_USER IN CUR_DISABLE_USER LOOP
FND_USER_PKG.DisableUser(REC_DISABLE_USER.USER_NAME);
L_DEAL_COUNT := L_DEAL_COUNT+L_DEAL_COUNT;
END LOOP;
DBMS 〝 output. Put 〝 line ('number of successful and invalid users: 'め L 〝 de al 〝 count);
END;
--Add user responsibilities:
FND_USER_PKG.AddResp;
--Responsibilities of invalid users:
FND_USER_PKG.DelResp;
---Change the password directly. This is the password to be modified directly. After the user logs in again, log in directly. The following is the process of changing the password after the first user login.
SELECT fnd_web_sec.change_password(‘WX214492‘,‘samt261‘) FROM DUAL
---Verify the validity of the password
SELECT fnd_web_sec.validate_login(‘WX214492‘,‘samt2611‘) FROM DUAL
---Get error information.
select fnd_message.get() from dual;
---Get encrypted password
Declare
l_enc_fnd_pwd VARCHAR2(4000);
l_enc_user_pwd VARCHAR2(4000);
L_RETURN VARCHAR2(4000);
Begin
L_RETURN := fnd_web_sec.get_encrypted_passwords(‘WX214492‘,5954,‘11samt2611‘,l_enc_fnd_pwd,l_enc_user_pwd);
DBMS_OUTPUT.PUT_LINE(‘L_RETURN:‘||L_RETURN);
DBMS_OUTPUT.PUT_LINE(‘p_enc_fnd_pwd:‘||l_enc_fnd_pwd||CHR(10)||‘p_enc_user_pwd:‘||l_enc_user_pwd);
End;
---Modified: encrypted "user" password, not tested temporarily.
Declare
newpass varchar2(100);
Begin
newpass := fnd_user_pkg.getreencryptedpassword(‘WX214492‘, ‘NEWKEY‘);
DBMS_OUTPUT.PUT_LINE(‘newpass:‘||newpass);
--fnd_user_pkg.setreencryptedpassword(‘WX214492‘, newpass, ‘NEWKEY‘);
End;
---------------
---Batch invalid user----
---------------
DECLARE
CURSOR CUR_DISABLE_USER
IS
SELECT USER_NAME
FROM FND_USER
WHERE SYSDATE BETWEEN START_DATE AND NVL(END_DATE,SYSDATE+1)
AND USER_NAME IN (
‘AH502998‘
);
L_DEAL_COUNT NUMBER;
BEGIN
fnd_global.APPS_Initialize( user_id=>1183, resp_id=>20420, resp_appl_id =>1);
L_DEAL_COUNT := 0;
FOR REC_DISABLE_USER IN CUR_DISABLE_USER LOOP
FND_USER_PKG.DisableUser(REC_DISABLE_USER.USER_NAME);
L_DEAL_COUNT := L_DEAL_COUNT+1;
END LOOP;
COMMIT;
DBMS 〝 output. Put 〝 line ('number of successful and invalid users: 'め L 〝 de al 〝 count);
END;
---------------------
---Responsibilities of invalid users----
---------------------
---A duty that has not been used for a certain period of time.
DECLARE
CURSOR CUR_DISABLE
IS
SELECT FU.USER_ID
,FU.USER_NAME
,FRESP.APPLICATION_SHORT_NAME
,FRESP.RESPONSIBILITY_KEY
,FRESP.SECURITY_GROUP_KEY
,FRESP.RESPONSIBILITY_NAME
,FRESP.START_DATE
,FRESP.END_DATE
,RESP_LOGIN.MAX_START_TIME
FROM FND_USER_RESP_GROUPS_DIRECT_V FRESP
FND_USER FU
,(SELECT FL.USER_ID,FLR.RESPONSIBILITY_ID,MAX(FLR.START_TIME) MAX_START_TIME
FROM FND_LOGIN_RESPONSIBILITIES FLR,FND_LOGINS FL
WHERE FLR.LOGIN_ID = FL.LOGIN_ID
GROUP BY FL.USER_ID,FLR.RESPONSIBILITY_ID) RESP_LOGIN
WHERE 1=1
AND FU.USER_ID = FRESP.USER_ID
AND RESP_LOGIN.USER_ID(+) = FRESP.USER_ID
AND RESP_LOGIN.RESPONSIBILITY_ID(+) = FRESP.RESPONSIBILITY_ID
AND ((SYSDATE - RESP_LOGIN.MAX_START_TIME) >= 60 OR RESP_LOGIN.MAX_START_TIME IS NULL)
AND SYSDATE BETWEEN FU.START_DATE AND NVL(FU.END_DATE,SYSDATE+1)
AND SYSDATE BETWEEN FRESP.START_DATE AND NVL(FRESP.END_DATE,SYSDATE+1)
AND FU.USER_NAME = ‘WX214492‘
AND FRESP.RESPONSIBILITY_KEY = ‘XYG-WH-WCB-OM-QUERY‘
ORDER BY FU.USER_NAME,FRESP.RESPONSIBILITY_NAME;
L_DEAL_COUNT NUMBER;
BEGIN
fnd_global.APPS_Initialize( user_id=>1183, resp_id=>20420, resp_appl_id =>1);
L_DEAL_COUNT := 0;
DELETE XYG_PUB_COMMON_TABLE_TEMP;
FOR REC_DISABLE IN CUR_DISABLE LOOP
FND_USER_PKG.DelResp(REC_DISABLE.USER_NAME,REC_DISABLE.APPLICATION_SHORT_NAME,REC_DISABLE.RESPONSIBILITY_KEY,REC_DISABLE.SECURITY_GROUP_KEY);
L_DEAL_COUNT := L_DEAL_COUNT+1;
END LOOP;
COMMIT;
DBMS | output. Put | line ('number of successful and invalid responsibilities: '| L | de al | count);
END;
(Oracle EBS) and standard user-related APIs for processing [Z]