Skip to content

Commit

Permalink
PageSelfProfile experiments
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Oct 7, 2015
1 parent 63f9ca5 commit ba21c1b
Show file tree
Hide file tree
Showing 5 changed files with 2,030 additions and 1,964 deletions.
Expand Up @@ -68,10 +68,12 @@
import com.evolveum.midpoint.web.security.WebApplicationConfiguration;
import com.evolveum.midpoint.web.session.UserProfileStorage;
import com.evolveum.midpoint.web.util.WebMiscUtil;
import com.evolveum.midpoint.web.util.WebModelUtils;
import com.evolveum.midpoint.web.util.validation.MidpointFormValidatorImpl;
import com.evolveum.midpoint.web.util.validation.MidpointFormValidatorRegistry;
import com.evolveum.midpoint.wf.api.WorkflowManager;
import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;

import org.apache.commons.lang.Validate;
import org.apache.wicket.Component;
import org.apache.wicket.injection.Injector;
Expand All @@ -89,6 +91,9 @@
* @author lazyman
*/
public abstract class PageBase extends PageTemplate {

private static final String DOT_CLASS = PageBase.class.getName() + ".";
private static final String OPERATION_LOAD_USER = DOT_CLASS + "loadUser";

private static final Trace LOGGER = TraceManager.getTrace(PageBase.class);

Expand Down Expand Up @@ -562,4 +567,23 @@ private MainMenuItem createRolesItems() {

return item;
}

protected PrismObject<UserType> loadUserSelf(PageBase page) {
MidPointPrincipal principal = SecurityUtils.getPrincipalUser();
Validate.notNull(principal, "No principal");
if (principal.getOid() == null) {
throw new IllegalArgumentException("No OID in principal: "+principal);
}

OperationResult result = new OperationResult(OPERATION_LOAD_USER);
PrismObject<UserType> user = WebModelUtils.loadObject(UserType.class,
principal.getOid(), result, page);
result.computeStatus();

if (!WebMiscUtil.isSuccessOrHandledError(result)) {
showResult(result);
}

return user;
}
}

0 comments on commit ba21c1b

Please sign in to comment.