use of net.sourceforge.prograde.policyparser.ParsedPermission in project ddf by codice.
the class PermissionActivator method buildConditionalPermissionInfo.
/**
* This method will allow policy entries with no permissions for the case where there are
* pre-defined policy entries for administrators to add configuration specific permissions.
*/
private void buildConditionalPermissionInfo(List<ParsedPolicyEntry> entries, List<ConditionalPermissionInfo> infos, String type) {
for (ParsedPolicyEntry parsedPolicyEntry : entries) {
List<ParsedPermission> permissions = parsedPolicyEntry.getPermissions();
if (permissions.isEmpty()) {
// Allow policy entries with no permissions.
continue;
}
PermissionInfo[] permissionInfos = new PermissionInfo[permissions.size()];
int index = 0;
for (ParsedPermission parsedPermission : permissions) {
permissionInfos[index++] = new PermissionInfo(parsedPermission.getPermissionType(), replaceSystemProperties(parsedPermission.getPermissionName()), parsedPermission.getActions());
}
List<ConditionInfo> conditionInfos = new ArrayList<>();
addCodebase(parsedPolicyEntry, conditionInfos);
addSignedBy(parsedPolicyEntry, conditionInfos);
addPrincipals(parsedPolicyEntry, conditionInfos);
infos.add(conditionalPermissionAdmin.newConditionalPermissionInfo(null, (conditionInfos.isEmpty()) ? null : conditionInfos.toArray(new ConditionInfo[conditionInfos.size()]), permissionInfos, type));
}
}
Aggregations