Search in sources :

Example 1 with DelegationModel

use of com.sun.identity.console.delegation.model.DelegationModel in project OpenAM by OpenRock.

the class DelegationPropertiesViewBean method handleButton1Request.

/**
     * Handles save button request.
     *
     * @param event Request invocation event
     */
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
    submitCycle = true;
    DelegationModel model = (DelegationModel) getModel();
    String uid = (String) getPageSessionAttribute(CURRENT_IDENTITY);
    AMPropertySheet ps = (AMPropertySheet) getChild(DELEGATION_PROPERTIES);
    String realm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    try {
        PrivilegeXMLBuilder builder = PrivilegeXMLBuilder.getInstance();
        Set privileges = builder.getAllPrivileges(realm, model);
        Map values = ps.getAttributeValues(privileges);
        model.setPrivileges(realm, uid, values);
        setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "delegation.privilege.updated");
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    forwardTo();
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) DelegationModel(com.sun.identity.console.delegation.model.DelegationModel) AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) PrivilegeXMLBuilder(com.sun.identity.console.property.PrivilegeXMLBuilder) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with DelegationModel

use of com.sun.identity.console.delegation.model.DelegationModel in project OpenAM by OpenRock.

the class DelegationPropertiesViewBean method getBreadCrumbDisplayName.

protected String getBreadCrumbDisplayName() {
    String message = "breadcrumbs.realm.pivilege.editPrivilege";
    DelegationModel model = (DelegationModel) getModel();
    String[] tmp = { getDisplayName() };
    return MessageFormat.format(model.getLocalizedString(message), (Object[]) tmp);
}
Also used : DelegationModel(com.sun.identity.console.delegation.model.DelegationModel)

Example 3 with DelegationModel

use of com.sun.identity.console.delegation.model.DelegationModel in project OpenAM by OpenRock.

the class DelegationViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    DelegationModel model = (DelegationModel) getModel();
    setPageTitle(model, "page.title.delegation");
    tblModel.setTitle("table.delegation.title.name");
    tblModel.setTitleLabel("table.delegation.summary");
    tblModel.setSummary("table.delegation.summary");
    getSubjects();
}
Also used : DelegationModel(com.sun.identity.console.delegation.model.DelegationModel)

Example 4 with DelegationModel

use of com.sun.identity.console.delegation.model.DelegationModel in project OpenAM by OpenRock.

the class DelegationViewBean method populateTableModel.

private void populateTableModel(Collection DelegationNames) {
    tblModel.clearAll();
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    if ((DelegationNames != null) && !DelegationNames.isEmpty()) {
        List cache = new ArrayList(DelegationNames.size());
        DelegationModel model = (DelegationModel) getModel();
        SSOToken ssoToken = model.getUserSSOToken();
        boolean firstEntry = true;
        for (Iterator iter = DelegationNames.iterator(); iter.hasNext(); ) {
            String id = (String) iter.next();
            try {
                AMIdentity entity = IdUtils.getIdentity(ssoToken, id);
                if (firstEntry) {
                    firstEntry = false;
                } else {
                    tblModel.appendRow();
                }
                String name = AMFormatUtils.getIdentityDisplayName(model, entity);
                tblModel.setValue(TBL_DATA_NAME, name);
                tblModel.setValue(TBL_DATA_UNIVERSALNAME, id);
                tblModel.setValue(TBL_DATA_ACTION_HREF, stringToHex(id));
                cache.add(id);
            } catch (IdRepoException e) {
            //ignore since ID is not found.
            }
        }
        szCache.setValue((Serializable) cache);
    } else {
        szCache.setValue(null);
    }
}
Also used : SSOToken(com.iplanet.sso.SSOToken) DelegationModel(com.sun.identity.console.delegation.model.DelegationModel) SerializedField(com.sun.identity.console.components.view.html.SerializedField) AMIdentity(com.sun.identity.idm.AMIdentity) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) IdRepoException(com.sun.identity.idm.IdRepoException) ArrayList(java.util.ArrayList) List(java.util.List)

Example 5 with DelegationModel

use of com.sun.identity.console.delegation.model.DelegationModel in project OpenAM by OpenRock.

the class DelegationPropertiesViewBean method getDisplayName.

/**
     * Retrieve the name from the current object and convert it to a
     * displayable format.
     */
private String getDisplayName() {
    String displayName = "";
    DelegationModel model = (DelegationModel) getModel();
    String uid = (String) getPageSessionAttribute(CURRENT_IDENTITY);
    try {
        AMIdentity entity = IdUtils.getIdentity(model.getUserSSOToken(), uid);
        displayName = AMFormatUtils.getIdentityDisplayName(model, entity);
    } catch (IdRepoException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", model.getErrorString(e));
    }
    return displayName;
}
Also used : DelegationModel(com.sun.identity.console.delegation.model.DelegationModel) AMIdentity(com.sun.identity.idm.AMIdentity) IdRepoException(com.sun.identity.idm.IdRepoException)

Aggregations

DelegationModel (com.sun.identity.console.delegation.model.DelegationModel)7 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)2 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)2 AMIdentity (com.sun.identity.idm.AMIdentity)2 IdRepoException (com.sun.identity.idm.IdRepoException)2 SSOToken (com.iplanet.sso.SSOToken)1 SerializedField (com.sun.identity.console.components.view.html.SerializedField)1 PrivilegeXMLBuilder (com.sun.identity.console.property.PrivilegeXMLBuilder)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1