use of org.onosproject.security.AppPermission in project onos by opennetworkinglab.
the class DefaultPolicyBuilder method convertToJavaPermissions.
public static List<Permission> convertToJavaPermissions(Set<org.onosproject.security.Permission> permissions) {
List<Permission> result = Lists.newArrayList();
for (org.onosproject.security.Permission perm : permissions) {
Permission javaPerm = getPermission(perm);
if (javaPerm != null) {
if (javaPerm instanceof AppPermission) {
if (((AppPermission) javaPerm).getType() != null) {
AppPermission ap = (AppPermission) javaPerm;
result.add(ap);
if (serviceDirectory.containsKey(ap.getType())) {
for (String service : serviceDirectory.get(ap.getType())) {
result.add(new ServicePermission(service, ServicePermission.GET));
}
}
}
} else if (javaPerm instanceof ServicePermission) {
if (!javaPerm.getName().contains(SecurityAdminService.class.getName())) {
result.add(javaPerm);
}
} else {
result.add(javaPerm);
}
}
}
return result;
}
Aggregations