Fixed issues in permission-scope mapping

revert-70aa11f8
Milan Perera 8 years ago
parent 637c014866
commit 42a587904f

@ -66,6 +66,8 @@ public class AnnotationProcessor {
private static final String SWAGGER_ANNOTATIONS_PROPERTIES_VALUE = "value";
private static final String ANNOTATIONS_SCOPES = "scopes";
private static final String PERMISSION_PREFIX = "/permission/admin";
private StandardContext context;
private Method[] pathClazzMethods;
@ -201,8 +203,9 @@ public class AnnotationProcessor {
Scope scope;
String permissions[];
StringBuilder aggregatedPermissions = new StringBuilder();
StringBuilder aggregatedPermissions;
for(int i=0; i<annotatedScopes.length; i++){
aggregatedPermissions = new StringBuilder();
methodHandler = Proxy.getInvocationHandler(annotatedScopes[i]);
scope = new Scope();
scope.setName(invokeMethod(scopeClass
@ -214,6 +217,7 @@ public class AnnotationProcessor {
permissions = (String[])methodHandler.invoke(annotatedScopes[i], scopeClass
.getMethod(SWAGGER_ANNOTATIONS_PROPERTIES_PERMISSIONS, null),null);
for (String permission : permissions) {
aggregatedPermissions.append(PERMISSION_PREFIX);
aggregatedPermissions.append(permission);
aggregatedPermissions.append(" ");
}

@ -63,6 +63,8 @@ public class AnnotationProcessor {
private static final String SWAGGER_ANNOTATIONS_PROPERTIES_PERMISSIONS = "permissions";
private static final String ANNOTATIONS_SCOPES = "scopes";
private static final String PERMISSION_PREFIX = "/permission/admin";
private StandardContext context;
private Method[] pathClazzMethods;
private Class<Path> pathClazz;
@ -391,8 +393,9 @@ public class AnnotationProcessor {
Scope scope;
String permissions[];
StringBuilder aggregatedPermissions = new StringBuilder();
StringBuilder aggregatedPermissions;
for(int i=0; i<annotatedScopes.length; i++){
aggregatedPermissions = new StringBuilder();
methodHandler = Proxy.getInvocationHandler(annotatedScopes[i]);
scope = new Scope();
scope.setName(invokeMethod(scopeClass
@ -403,8 +406,8 @@ public class AnnotationProcessor {
.getMethod(SWAGGER_ANNOTATIONS_PROPERTIES_KEY), annotatedScopes[i], STRING));
permissions = (String[])methodHandler.invoke(annotatedScopes[i], scopeClass
.getMethod(SWAGGER_ANNOTATIONS_PROPERTIES_PERMISSIONS, null),null);
aggregatedPermissions.setLength(0);
for (String permission : permissions) {
aggregatedPermissions.append(PERMISSION_PREFIX);
aggregatedPermissions.append(permission);
aggregatedPermissions.append(" ");
}

@ -62,53 +62,84 @@
"copyrightSuffix" : " All Rights Reserved."
},
"scopes" : [
"user:manage",
"user:view",
"device-type:admin:view",
"device:view",
"notification:view",
"device:admin:view",
"application:manage",
"activity:view",
"user:admin:reset-password",
"policy:manage",
"policy:view",
"role:manage",
"role:view",
"configuration:view",
"configuration:modify",
"device:android:operation:reboot",
"device:android:operation:camera",
"device:android:operation:vpn",
"device:android:operation:lock",
"device:android:operation:ring",
"device:android:operation:update-app",
"device:android:operation:wipe",
"device:android:operation:encrypt",
"device:android:operation:blacklist-app",
"device:android:operation:applications",
"device:android:operation:enterprise-wipe",
"device:android:operation:info",
"device:android:operation:wifi",
"device:android:operation:uninstall-app",
"device:android:operation:change-lock",
"device:android:operation:notification",
"device:android:operation:upgrade",
"device:android:operation:unlock",
"device:android:operation:mute",
"device:android:operation:location",
"device:android:operation:webclip",
"device:android:operation:clear-password",
"device:android:operation:password-policy",
"device:android:operation:install-app",
"device:android:event:write",
"device:android:event:read",
"device:android:enroll",
"configuration:manage",
"configuration:view",
"device:android:enroll",
"certificate:view",
"certificate:manage"
"perm:sign-csr",
"perm:admin:devices:view",
"perm:roles:add",
"perm:roles:add-users",
"perm:roles:update",
"perm:roles:permissions",
"perm:roles:details",
"perm:roles:view",
"perm:roles:create-combined-role",
"perm:roles:delete",
"perm:dashboard:vulnerabilities",
"perm:dashboard:non-compliant-count",
"perm:dashboard:non-compliant",
"perm:dashboard:by-groups",
"perm:dashboard:device-counts",
"perm:dashboard:feature-non-compliant",
"perm:dashboard:count-overview",
"perm:dashboard:filtered-count",
"perm:dashboard:details",
"perm:get-activity",
"perm:devices:delete",
"perm:devices:applications",
"perm:devices:effective-policy",
"perm:devices:compliance-data",
"perm:devices:features",
"perm:devices:operations",
"perm:devices:search",
"perm:devices:details",
"perm:devices:view",
"perm:view-configuration",
"perm:manage-configuration",
"perm:policies:remove",
"perm:policies:priorities",
"perm:policies:deactivate",
"perm:policies:get-policy-details",
"perm:policies:manage",
"perm:policies:activate",
"perm:policies:update",
"perm:policies:changes",
"perm:policies:get-details",
"perm:users:add",
"perm:users:details",
"perm:users:count",
"perm:users:delete",
"perm:users:roles",
"perm:users:user-details",
"perm:users:credentials",
"perm:users:search",
"perm:users:is-exist",
"perm:users:update",
"perm:users:send-invitation",
"perm:admin-users:view",
"perm:groups:devices",
"perm:groups:update",
"perm:groups:add",
"perm:groups:device",
"perm:groups:devices-count",
"perm:groups:remove",
"perm:groups:groups",
"perm:groups:groups-view",
"perm:groups:share",
"perm:groups:count",
"perm:groups:roles",
"perm:groups:devices-remove",
"perm:groups:devices-add",
"perm:groups:assign",
"perm:device-types:features",
"perm:device-types:types",
"perm:applications:install",
"perm:applications:uninstall",
"perm:admin-groups:count",
"perm:admin-groups:view",
"perm:notifications:mark-checked",
"perm:notifications:view",
"perm:admin:certificates:delete",
"perm:admin:certificates:details",
"perm:admin:certificates:view",
"perm:admin:certificates:add"
],
"isOAuthEnabled" : true,
"backendRestEndpoints" : {

@ -1940,7 +1940,7 @@
<commons-lang.wso2.osgi.version.range>[2.6.0,3.0.0)</commons-lang.wso2.osgi.version.range>
<!-- Carbon API Management -->
<carbon.api.mgt.version>6.1.30-SNAPSHOT</carbon.api.mgt.version>
<carbon.api.mgt.version>6.1.35</carbon.api.mgt.version>
<carbon.api.mgt.version.range>(6.0.0,7.0.0]</carbon.api.mgt.version.range>
<!-- Carbon Analytics Commons -->

Loading…
Cancel
Save