Skip to content

Commit

Permalink
Fixing NPE related to lockout processing
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Apr 11, 2016
1 parent ce75726 commit ea1c919
Showing 1 changed file with 14 additions and 11 deletions.
Expand Up @@ -523,18 +523,21 @@ private <F extends FocusType> void processActivationLockout(LensFocusContext<Use
OperationResult result)
throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException, PolicyViolationException {

PropertyDelta<LockoutStatusType> lockoutStatusDelta = focusContext.getPrimaryDelta().findPropertyDelta(SchemaConstants.PATH_ACTIVATION_LOCKOUT_STATUS);
if (lockoutStatusDelta != null) {
if (lockoutStatusDelta.isAdd()) {
for (PrismPropertyValue<LockoutStatusType> pval: lockoutStatusDelta.getValuesToAdd()) {
if (pval.getValue() == LockoutStatusType.LOCKED) {
throw new SchemaException("Lockout status cannot be changed to LOCKED value");
ObjectDelta<UserType> focusPrimaryDelta = focusContext.getPrimaryDelta();
if (focusPrimaryDelta != null) {
PropertyDelta<LockoutStatusType> lockoutStatusDelta = focusContext.getPrimaryDelta().findPropertyDelta(SchemaConstants.PATH_ACTIVATION_LOCKOUT_STATUS);
if (lockoutStatusDelta != null) {
if (lockoutStatusDelta.isAdd()) {
for (PrismPropertyValue<LockoutStatusType> pval: lockoutStatusDelta.getValuesToAdd()) {
if (pval.getValue() == LockoutStatusType.LOCKED) {
throw new SchemaException("Lockout status cannot be changed to LOCKED value");
}
}
}
} else if (lockoutStatusDelta.isReplace()) {
for (PrismPropertyValue<LockoutStatusType> pval: lockoutStatusDelta.getValuesToReplace()) {
if (pval.getValue() == LockoutStatusType.LOCKED) {
throw new SchemaException("Lockout status cannot be changed to LOCKED value");
} else if (lockoutStatusDelta.isReplace()) {
for (PrismPropertyValue<LockoutStatusType> pval: lockoutStatusDelta.getValuesToReplace()) {
if (pval.getValue() == LockoutStatusType.LOCKED) {
throw new SchemaException("Lockout status cannot be changed to LOCKED value");
}
}
}
}
Expand Down

0 comments on commit ea1c919

Please sign in to comment.