Search in sources :

Example 41 with DelegationConfig

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

the class AuthConfigViewBean method createPropertyModel.

private void createPropertyModel(String realmName) {
    DelegationConfig dConfig = DelegationConfig.getInstance();
    boolean canModify = dConfig.hasPermission(realmName, null, AMAdminConstants.PERMISSION_MODIFY, getModel(), getClass().getName());
    String xmlFile = (canModify) ? "com/sun/identity/console/propertyAuthConfig.xml" : "com/sun/identity/console/propertyAuthConfig_Readonly.xml";
    propertySheetModel = new AMPropertySheetModel(getClass().getClassLoader().getResourceAsStream(xmlFile));
    propertySheetModel.clear();
}
Also used : AMPropertySheetModel(com.sun.identity.console.base.model.AMPropertySheetModel) DelegationConfig(com.sun.identity.console.delegation.model.DelegationConfig)

Example 42 with DelegationConfig

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

the class AMServiceProfileModelImpl method getPropertySheetXML.

/**
     * Returns the XML for property sheet view component.
     *
     * @param realmName Name of Realm.
     * @param viewbeanClassName Class Name of View Bean.
     * @param serviceName Name of Service.
     * @return the XML for property sheet view component.
     * @throws AMConsoleException if XML cannot be created.
     */
public String getPropertySheetXML(String realmName, String viewbeanClassName, String serviceName) throws AMConsoleException {
    DelegationConfig dConfig = DelegationConfig.getInstance();
    boolean canModify = dConfig.hasPermission(realmName, serviceName, AMAdminConstants.PERMISSION_MODIFY, this, viewbeanClassName);
    if (!canModify) {
        xmlBuilder.setAllAttributeReadOnly(true);
    }
    try {
        /*
             * the location needs to be set in order for the page to be 
             * constructed correctly. Some choice value components can have 
             * their values built based on the realm.
             */
        return xmlBuilder.getXML(realmName);
    } catch (SMSException e) {
        throw new AMConsoleException(getErrorString(e));
    } catch (SSOException e) {
        throw new AMConsoleException(getErrorString(e));
    }
}
Also used : SMSException(com.sun.identity.sm.SMSException) DelegationConfig(com.sun.identity.console.delegation.model.DelegationConfig) SSOException(com.iplanet.sso.SSOException)

Example 43 with DelegationConfig

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

the class EntitiesModelImpl method getPropertyXMLString.

/**
     * Returns property sheet XML for Entity Profile.
     *
     * @param realmName Name of Realm.
     * @param idType Type of Entity.
     * @param agentType agent type.
     * @param bCreate <code>true</code> for creation operation.
     * @param viewbeanClassName Class Name of View Bean.
     * @return property sheet XML for Entity Profile.
     */
public String getPropertyXMLString(String realmName, String idType, String agentType, boolean bCreate, String viewbeanClassName) throws AMConsoleException {
    setLocationDN(realmName);
    String xml = null;
    try {
        Set attributeSchemas = getAttributeSchemas(idType, agentType, bCreate);
        String serviceName = getSvcNameForIdType(idType, agentType);
        if (serviceName != null) {
            PropertyXMLBuilder builder = new PropertyXMLBuilder(serviceName, this, attributeSchemas);
            cacheAttributeValidators(attributeSchemas);
            if (!bCreate) {
                DelegationConfig dConfig = DelegationConfig.getInstance();
                if (!dConfig.hasPermission(realmName, null, AMAdminConstants.PERMISSION_MODIFY, this, viewbeanClassName)) {
                    builder.setAllAttributeReadOnly(true);
                }
            }
            xml = builder.getXML(readOnlyAttributeNames, true);
        }
    } catch (AMConsoleException e) {
        debug.warning("EntitiesModelImpl.getPropertyXMLString", e);
    } catch (IdRepoException e) {
        debug.warning("EntitiesModelImpl.getPropertyXMLString", e);
    } catch (SMSException e) {
        debug.warning("EntitiesModelImpl.getPropertyXMLString", e);
    } catch (SSOException e) {
        debug.warning("EntitiesModelImpl.getPropertyXMLString", e);
    }
    if (bCreate) {
        String xmlFile = (isWSSEnabled && idType.equalsIgnoreCase("agent")) ? "com/sun/identity/console/propertyEntitiesAddAgentType.xml" : "com/sun/identity/console/propertyEntitiesAdd.xml";
        String header = AMAdminUtils.getStringFromInputStream(getClass().getClassLoader().getResourceAsStream(xmlFile));
        if (xml != null) {
            xml = PropertyXMLBuilder.prependXMLProperty(xml, header);
        } else {
            xml = PropertyXMLBuilder.formPropertySheetXML(header);
        }
    } else {
        String xmlFile = "com/sun/identity/console/propertyEntitiesEdit.xml";
        String extra = AMAdminUtils.getStringFromInputStream(getClass().getClassLoader().getResourceAsStream(xmlFile));
        if (xml != null) {
            xml = PropertyXMLBuilder.appendXMLProperty(xml, extra);
        } else {
            xml = PropertyXMLBuilder.formPropertySheetXML(extra, true);
        }
    }
    return xml;
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) SMSException(com.sun.identity.sm.SMSException) IdRepoException(com.sun.identity.idm.IdRepoException) DelegationConfig(com.sun.identity.console.delegation.model.DelegationConfig) SSOException(com.iplanet.sso.SSOException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) PropertyXMLBuilder(com.sun.identity.console.property.PropertyXMLBuilder)

Aggregations

DelegationConfig (com.sun.identity.console.delegation.model.DelegationConfig)43 AMPropertySheetModel (com.sun.identity.console.base.model.AMPropertySheetModel)32 SSOException (com.iplanet.sso.SSOException)8 SMSException (com.sun.identity.sm.SMSException)8 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)7 PropertyXMLBuilder (com.sun.identity.console.property.PropertyXMLBuilder)4 CCAddRemoveModel (com.sun.web.ui.model.CCAddRemoveModel)4 InputStream (java.io.InputStream)4 ServiceSchema (com.sun.identity.sm.ServiceSchema)3 Set (java.util.Set)3 HashSet (java.util.HashSet)2 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 SAMLPropertyXMLBuilder (com.sun.identity.console.federation.SAMLPropertyXMLBuilder)1 EndUserViewBean (com.sun.identity.console.idm.EndUserViewBean)1 SubConfigPropertyXMLBuilder (com.sun.identity.console.property.SubConfigPropertyXMLBuilder)1 IdRepoException (com.sun.identity.idm.IdRepoException)1 ServiceSchemaManager (com.sun.identity.sm.ServiceSchemaManager)1 List (java.util.List)1