Infolinks

Saturday 21 July 2012

Stop specific user from log in to application

Stop specific user from log in to application

Requirement:
There are over 300 users in the application. We need to stop the users to log into the application for 3 days every month except for 3 users.

Solution:
Register the below procedures as concurrent programs in oracle apps.

The first procedure - XXFND_DISABLE_USER_ACCESS will disable all the users’ access (except three users) to the application.

The second procedure - XXFND_ENABLE_USER_ACCESS will enable all the users’ access to the application which were disabled 3 days back.
PROCEDURE XXFND_DISABLE_USER_ACCESS(piv_errbuff   OUT VARCHAR2,
                                    pin_retcode   OUT NUMBER)
IS
BEGIN

FND_USER_PKG.updateuser(x_user_name=>'RAM',x_owner=>'CUST',x_end_date=>SYSDATE);
EXCEPTION
   WHEN OTHERS
   THEN
      fnd_file.put_line (fnd_file.LOG,
                         'OTHERS exception while ending the user access');
END XXFND_DISABLE_USER_ACCESS;



PROCEDURE XXFND_ENABLE_USER_ACCESS(piv_errbuff   OUT VARCHAR2,
                                   pin_retcode   OUT NUMBER)
IS
BEGIN 

If end_date = sysdate-3 then
   FND_USER_PKG.EnableUser(x_username => ‘RAM’);
end if;
EXCEPTION
   WHEN OTHERS
   THEN
      fnd_file.put_line (fnd_file.LOG,
                         'OTHERS exception while ending the user access');
END XXFND_ENABLE_USER_ACCESS;


Syntax:
Procedures in FND_USER_PKG
procedure UpdateUser (
  x_user_name                  in varchar2,
  x_owner                      in varchar2,
  x_unencrypted_password       in varchar2 default null,
  x_session_number             in number default null,
  x_start_date                 in date default null,
  x_end_date                   in date default null,
  x_last_logon_date            in date default null,
  x_description                in varchar2 default null,
  x_password_date              in date default null,
  x_password_accesses_left     in number default null,
  x_password_lifespan_accesses in number default null,
  x_password_lifespan_days     in number default null,
  x_employee_id                in number default null,
  x_email_address              in varchar2 default null,
  x_fax                        in varchar2 default null,
  x_customer_id                in number default null,
  x_supplier_id                in number default null,
  x_old_password               in varchar2 default null);


procedure EnableUser(username varchar2,
                     start_date date default sysdate,
                     end_date date default fnd_user_pkg.null_date);
 
The first concurrent program (with procedure XXFND_DISABLE_USER_ACCESS) has to be scheduled in such a way that it runs on a particular day of every month (say at the begin of 1st day of every month).

The second concurrent program (with procedure XXFND_ENABLE_USER_ACCESS) has to be scheduled in such a way that it runs on a particular day of every month (say at the end of 3rd day of every month)

No comments:

Post a Comment