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();
}
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));
}
}
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;
}
Aggregations