use of org.apache.directory.fortress.core.model.PermissionAttribute in project directory-fortress-core by apache.
the class PermDAO method unloadPALdapEntry.
private PermissionAttribute unloadPALdapEntry(Entry le, long sequence) throws LdapInvalidAttributeValueException {
PermissionAttribute entity = new ObjectFactory().createPermissionAttribute();
entity.setSequenceId(sequence);
entity.setAttributeName(getAttribute(le, SchemaConstants.CN_AT));
entity.setDn(le.getDn().getName());
entity.setInternalId(getAttribute(le, GlobalIds.FT_IID));
entity.setDescription(getAttribute(le, SchemaConstants.DESCRIPTION_AT));
entity.setDataType(getAttribute(le, GlobalIds.FT_PERMISSION_ATTRIBUTE_DATA_TYPE));
entity.setDefaultOperator(getAttribute(le, GlobalIds.FT_PERMISSION_ATTRIBUTE_DEFAULT_OPERATOR));
entity.setDefaultStrategy(getAttribute(le, GlobalIds.FT_PERMISSION_ATTRIBUTE_DEFAULT_STRATEGY));
entity.setDefaultValue(getAttribute(le, GlobalIds.FT_PERMISSION_ATTRIBUTE_DEFAULT_VALUE));
List<String> validValues = getAttributes(le, GlobalIds.FT_PERMISSION_ATTRIBUTE_VALID_VALUES);
if (validValues != null) {
for (String value : validValues) {
entity.getValidValues().add(value);
}
}
return entity;
}
use of org.apache.directory.fortress.core.model.PermissionAttribute in project directory-fortress-core by apache.
the class PermTestData method getPA.
public static PermissionAttribute getPA(String[] pa) {
PermissionAttribute permAttr = new PermissionAttribute();
permAttr.setAttributeName(pa[0]);
permAttr.setDataType(pa[2]);
permAttr.setDefaultOperator(ComparisonOperator.valueOf(pa[3]).name());
permAttr.getValidValues().add(pa[4]);
return permAttr;
}
use of org.apache.directory.fortress.core.model.PermissionAttribute in project directory-fortress-core by apache.
the class ReviewMgrImplTest method readPermissionAttributeSet.
public static void readPermissionAttributeSet(String msg, String name, Set<PermissionAttribute> permAttributes) {
LogUtil.logIt(msg);
try {
ReviewMgr reviewMgr = getManagedReviewMgr();
PermissionAttributeSet entity = reviewMgr.readPermAttributeSet(new PermissionAttributeSet(name));
assertNotNull(entity);
assertEquals(name, entity.getName());
assertEquals(PermTestData.TPA_SET_TYPE, entity.getType());
for (PermissionAttribute pa : permAttributes) {
assertTrue(entity.getAttributes().contains(pa));
}
LOG.debug("readPermissionAttributeSet name [" + name + "] successful");
} catch (SecurityException ex) {
LOG.error("readPermissionAttributeSet name [" + name + "] caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage() + ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.model.PermissionAttribute in project directory-fortress-core by apache.
the class PermTestData method loadPermissionAttributes.
public static Set<PermissionAttribute> loadPermissionAttributes(String[][] objArray) {
Set<PermissionAttribute> permAttrs = new HashSet<PermissionAttribute>();
for (String[] obj : objArray) {
PermissionAttribute pa = PermTestData.getPA(obj);
permAttrs.add(pa);
}
return permAttrs;
}
use of org.apache.directory.fortress.core.model.PermissionAttribute in project directory-fortress-core by apache.
the class AdminMgrRestImpl method updatePermissionAttributeInSet.
/**
* {@inheritDoc}
*/
@Override
public void updatePermissionAttributeInSet(PermissionAttribute permAttribute, String attributeSetName, boolean replaceValidValues) throws SecurityException {
VUtil.assertNotNull(permAttribute, GlobalErrIds.PERM_ATTRIBUTE_SET_NULL, CLS_NM + ".updatePermissionAttributeInSet");
VUtil.assertNotNull(attributeSetName, GlobalErrIds.PERM_ATTRIBUTE_SET_NM_NULL, CLS_NM + ".updatePermissionAttributeInSet");
PermissionAttribute retAttr;
FortRequest request = RestUtils.getRequest(this.contextId);
request.setEntity(permAttribute);
request.setValue(attributeSetName);
request.setIsFlag(replaceValidValues);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.PERM_UPDATE_PERM_ATTRIBUTE_IN_SET);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() != 0) {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
}
Aggregations