Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/support-3.7' into support-3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Apr 6, 2018
2 parents 30cc1e2 + fa0c5ec commit de933c4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
Expand Up @@ -36,15 +36,14 @@
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.apache.wicket.util.string.StringValue;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContextHolder;

import com.evolveum.midpoint.gui.api.component.password.PasswordPanel;
import com.evolveum.midpoint.gui.api.model.LoadableModel;
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.gui.api.util.WebModelServiceUtils;
import com.evolveum.midpoint.model.api.AuthenticationEvaluator;
import com.evolveum.midpoint.model.api.context.PasswordAuthenticationContext;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.delta.ObjectDelta;
import com.evolveum.midpoint.schema.GetOperationOptions;
import com.evolveum.midpoint.schema.SelectorOptions;
Expand All @@ -58,12 +57,9 @@
import com.evolveum.midpoint.web.application.PageDescriptor;
import com.evolveum.midpoint.web.application.Url;
import com.evolveum.midpoint.web.component.AjaxSubmitButton;
import com.evolveum.midpoint.web.component.input.TextPanel;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour;
import com.evolveum.midpoint.web.page.admin.users.PageUser;
import com.evolveum.midpoint.web.page.login.PageLogin;
import com.evolveum.midpoint.web.util.OnePageParameterEncoder;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;
import com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType;
Expand Down Expand Up @@ -98,6 +94,11 @@ public class PageAccountActivation extends PageBase {
public PageAccountActivation(PageParameters params) {

UserType user = loadUser(params);

if (user == null) {
getSession().error(getString("PageAccountActivation.account.activation.failed"));
throw new RestartResponseException(PageLogin.class);
}

userModel = new LoadableModel<UserType>(false) {

Expand All @@ -124,11 +125,16 @@ private UserType loadUser(PageParameters params){
OperationResult result = new OperationResult(LOAD_USER);

return runPrivileged(new Producer<UserType>() {
private static final long serialVersionUID = 1L;

@Override
public UserType run() {
Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(UserType.F_LINK_REF, GetOperationOptions.createResolve());
return WebModelServiceUtils.loadObject(UserType.class, userOid, options, PageAccountActivation.this, task, result).asObjectable();
PrismObject<UserType> user = WebModelServiceUtils.loadObject(UserType.class, userOid, options, PageAccountActivation.this, task, result);
if (user == null) {
return null;
}
return user.asObjectable();
}
});

Expand All @@ -148,7 +154,7 @@ public boolean isVisible() {

});

Form form = new com.evolveum.midpoint.web.component.form.Form<>(ID_MAIN_FORM);
Form<?> form = new com.evolveum.midpoint.web.component.form.Form<>(ID_MAIN_FORM);
activationContainer.add(form);

Label usernamePanel = new Label(ID_NAME, createStringResource("PageAccountActivation.activate.accounts.label", new PropertyModel<>(userModel, "name.orig")));
Expand Down Expand Up @@ -230,7 +236,7 @@ public void onClick(AjaxRequestTarget target) {
private String getOidFromParameter(PageParameters params){

if (params == null || params.isEmpty()) {
LOGGER.error("No page paraeters found for account activation. No user to activate his/her accounts");
LOGGER.error("No page parameters found for account activation. No user to activate his/her accounts");
return null;
}

Expand Down Expand Up @@ -277,6 +283,7 @@ private void propagatePassword(AjaxRequestTarget target,
}

OperationResult result = runPrivileged(new Producer<OperationResult>() {
private static final long serialVersionUID = 1L;

@Override
public OperationResult run() {
Expand Down Expand Up @@ -310,7 +317,7 @@ private List<ShadowType> getShadowsToActivate(){
if (shadowsToActivate == null || shadowsToActivate.isEmpty()) {
return new ArrayList<>();
}
return shadowsToActivate.parallelStream().filter(shadow -> shadow.getLifecycleState().equals(SchemaConstants.LIFECYCLE_PROPOSED)).collect(Collectors.toList());
return shadowsToActivate.parallelStream().filter(shadow -> SchemaConstants.LIFECYCLE_PROPOSED.equals(shadow.getLifecycleState())).collect(Collectors.toList());
}

}
Expand Up @@ -262,7 +262,7 @@ private void onSingleUserRequestPerformed(AjaxRequestTarget target) {
storage.getRoleCatalog().getAssignmentShoppingCart().clear();
} catch (Exception e) {
LoggingUtils.logUnexpectedException(LOGGER, "Could not save assignments ", e);
error("Could not save assignments. Reason: " + e);
error(createStringResource("PageAssignmentsList.saveAssignmentsError").getString() + e.getLocalizedMessage());
target.add(getFeedbackPanel());
} finally {
result.recomputeStatus();
Expand Down
Expand Up @@ -3650,6 +3650,7 @@ PageAssignmentsList.submitButton=Submit
PageAssignmentsList.resolveConflicts=Resolve conflicts
PageAssignmentsList.commentHere=Comment here...
PageAssignmentsList.requestComment=Request comment (optional)
PageAssignmentsList.saveAssignmentsError=Could not save assignments. Reason:
AssignmentShoppingCartPanel.treeTitle=Role catalog
AssignmentViewType.ROLE_CATALOG_VIEW=Role catalog view
AssignmentViewType.ROLE_TYPE=All roles view
Expand Down Expand Up @@ -3934,3 +3935,4 @@ pageAdminFocus.dataProtection=Data protection
PageInternals.title.cache=Caches
PageInternals.tab.cache=Cache management
InternalsCachePanel.button.clearCaches=Clear caches
PageAccountActivation.user.not.found=Unexpected problem occurs. Please contact system administrator.

0 comments on commit de933c4

Please sign in to comment.