use of com.cognifide.cq.cqsm.foundation.actions.removefromgroup.RemoveFromGroup in project APM by Cognifide.
the class DestroyUser method execute.
@Override
public ActionResult execute(Context context) throws ActionExecutionException {
ActionResult actionResult;
try {
User user = AuthorizablesUtils.getUser(context, userId);
context.setCurrentAuthorizable(user);
Action removeFromGroups = new RemoveFromGroup(getGroups(user));
ActionResult purgeResult = purge.execute(context);
ActionResult removeFromGroupsResult = removeFromGroups.execute(context);
ActionResult removeResult = remove.execute(context);
actionResult = new CompositeActionResult(purgeResult, removeFromGroupsResult, removeResult);
} catch (RepositoryException | ActionExecutionException e) {
actionResult = new ActionResult();
actionResult.logError(MessagingUtils.createMessage(e));
}
return actionResult;
}
use of com.cognifide.cq.cqsm.foundation.actions.removefromgroup.RemoveFromGroup in project APM by Cognifide.
the class DestroyUser method simulate.
@Override
public ActionResult simulate(Context context) throws ActionExecutionException {
ActionResult actionResult;
try {
User user = AuthorizablesUtils.getUser(context, userId);
context.setCurrentAuthorizable(user);
Action removeFromGroups = new RemoveFromGroup(getGroups(user));
ActionResult purgeResult = purge.simulate(context);
ActionResult removeFromGroupsResult = removeFromGroups.execute(context);
ActionResult removeResult = remove.simulate(context);
actionResult = new CompositeActionResult(purgeResult, removeFromGroupsResult, removeResult);
} catch (RepositoryException | ActionExecutionException e) {
actionResult = new ActionResult();
actionResult.logError(MessagingUtils.createMessage(e));
}
return actionResult;
}
Aggregations