Introduction
Deactivation allows, first of all, to rewrite all current and possible future tasks of a user to other selected users in the system. In addition, the user's substitutions, views, reports and notifications are rewritten.
Removal of a user from the system must always be preceded by deactivation.
The API for deactivating a user is provided by the service .
Available methods
/** * Deactivates the user. All views, overrides, notifications, reports and open tasks and possible * future tasks of the user will be rewritten to admin. * * @param userName User login * @author Paweł Rosolak 16 paź 2013 */ void deactivateUser( String userName ); /** * Deactivates the user * * @param deactivation An object containing all the information necessary to deactivate a user. * @author Rafał Nowacki 05-12-2014 */ void deactivateUser( Deactivation deactivation );
The first method performs deactivation and by default everything is passed to the user with the login 'admin'. The second method allows you to configure all assignments using the object
Deactivation obcject
Creation of the object is done as follows:
Deactivation deactivation = Deactivation.create( userNameToDeactivate );
The created object has the following information completed:
user deactivated:
User userToDeactivate = deactivation.getUser();
A list of all processes, roles and tasks in a tree format:
List<DeactivationProcess> processes = deactivation.getProcesses(); for(DeactivationProcess process : processes) { List<DeactivationParticipant> participants = process.getParticipants(); for ( DeactivationParticipant participant : participants ) { List<DeactivationActivity> activities = participant.getActivities(); } }
A list of default users, taken from the configuration file from the EmptyTaskUserName parameter. These users are used to assign tasks that do not have specific assignments:
List<User> defaultUsers = deactivation.getDefaultUsers();
Having a deactivation object, the following parameters should be set in it:
//Sets the user to whom substitutions will be prescribed. deactivation.setSubstitutionUser( substitutionUser ); //Sets the user to whom the views will be rewritten. deactivation.setViewUser( viewUser ); //Sets the user to whom the reports will be rewritten. deactivation.setReportUser( reportUser ); //Sets the user to whom notifications will be rewritten. deactivation.setNotificationUser( notificationUser );
The last thing to do is to specify to which users existing user task instances and possible future tasks should go. For existing task instances, it is required to set assignments for these task definitions. Other tasks do not need to be assigned. In this case, the default users defined in the configuration file from the EmptyTaskUserName parameter will be assigned to them.
Assignment of tasks can be done from the following levels:
deactivation object - assignments will be set for all tasks,
process level - assignments will be set for all tasks from the process,
role level - assignments will be set for all tasks from a role,
task level - assignments will be set only for this task.
You can assign tasks to both individual users and groups of users.
//assign users to all tasks deactivation.setUsers( users ); //assign groups to all tasks deactivation.setGroups( groups ); List<DeactivationProcess> processes = deactivation.getProcesses(); for(DeactivationProcess process : processes) { //assign users to all tasks from the process process.setUsers( users ); //assign user groups to all tasks from the process process.setGroups( groups ); List<DeactivationParticipant> participants = process.getParticipants(); for ( DeactivationParticipant participant : participants ) { //assign users to all tasks from the role participant.setUsers( users ); //assign user groups to all tasks from the role participant.setGroups( groups ); List<DeactivationActivity> activities = participant.getActivities(); for( DeactivationActivity activity : activities ) { if( activity.isAssigned() == true ) { //obowiązkowo należy przypisać użytkownika, bądź grupę użytkowników do tego zadania } //assigning users to a task activity.setUsers( users ); //assign user groups to the task activity.setGroups( groups ); //from the task level, you can also add a user or group individually activity.addUser( user ); activity.addGroup( group ); } } }
Validation
the deactivated user must exist,
the deactivated user must be active (i.e., it cannot have been deactivated before),
the user to whom substitutions will be assigned must be set and must not be the deactivated user,
the user to whom the views will be assigned must be set up and must not be the user to whom the deactivation applies,
the user to whom reports will be assigned must be set and must not be the user affected by the deactivation,
the user to whom notifications will be assigned must be set and must not be the user affected by the deactivation,
tasks whose instances are held by a deactivated user must have users or groups assigned to them, if a deactivated user is assigned, it is not taken into account.
Operations performed during user deactivation
saving task redirections from a deactivated user to other users, or groups, for possible future tasks that could go to an already deactivated user,
rewriting task instances of the deactivated user to defined users,
substitutions in which the deactivated user is a substitute are changed to the defined user,
substitutions in which the deactivated user is a substitute are deleted,
views of the deactivated user are rewritten to the defined user,
view shares of the deactivated user are deleted,
reports of the deactivated user are rewritten to the defined user,
report releases to the deactivated user are deleted,
notifications of the deactivated user are rewritten to the defined user,
disconnection of deactivated user from jobs,
calendar accesses to the deactivated user are deleted,
permissions granted to the deactivated user are deleted,
account settings of the deactivated user are deleted,
the user's defined document view is deleted,
deleting the deactivated user from all groups,
setting the user as inactive.