Remove Tabs, per Jococo
[aaf/authz.git] / cadi / aaf / src / main / java / org / onap / aaf / cadi / aaf / v2_0 / AAFLurPerm.java
index b1c600a..9f537bd 100644 (file)
@@ -88,8 +88,8 @@ public class AAFLurPerm extends AbsAAFLur<AAFPermission> {
     private void attachOAuth2(AAFCon<?> con) throws APIException {
         String oauth2_url;
         Class<?> tmcls = Config.loadClass(access,"org.osaaf.cadi.oauth.TokenMgr");
-        if(tmcls!=null) {
-            if((oauth2_url = con.access.getProperty(Config.CADI_OAUTH2_URL,null))!=null) {
+        if (tmcls!=null) {
+            if ((oauth2_url = con.access.getProperty(Config.CADI_OAUTH2_URL,null))!=null) {
                 try {
                     Constructor<?> tmconst = tmcls.getConstructor(AAFCon.class,String.class);
                     Object tokMangr = tmconst.newInstance(con,oauth2_url);
@@ -119,12 +119,17 @@ public class AAFLurPerm extends AbsAAFLur<AAFPermission> {
                 @Override
                 public User<AAFPermission> code(Rcli<?> client) throws CadiException, ConnectException, APIException {
                     final long remoteStart = System.nanoTime();
-                    Future<Perms> fp = client.read("/authz/perms/user/"+name,aaf.permsDF);
+                    StringBuilder sb = new StringBuilder("/authz/perms/user/");
+                    sb.append(name);
+                    if(details) {
+                        sb.append("?force");
+                    }
+                    Future<Perms> fp = client.read(sb.toString(),aaf.permsDF);
                     
                     // In the meantime, lookup User, create if necessary
                     User<AAFPermission> user = getUser(principal);
                     Principal p;
-                    if(user!=null && user.principal == null) {
+                    if (user!=null && user.principal == null) {
                         p = new Principal() {// Create a holder for lookups
                             private String n = name;
                             public String getName() {
@@ -135,20 +140,20 @@ public class AAFLurPerm extends AbsAAFLur<AAFPermission> {
                         p = principal;
                     }
                     
-                    if(user==null) {
+                    if (user==null) {
                         addUser(user = new User<AAFPermission>(p,aaf.userExpires)); // no password
                     }
                     
                     // OK, done all we can, now get content
                     boolean ok = fp.get(aaf.timeout);
                     remote.set(Timing.millis(remoteStart));
-                    if(ok) {
+                    if (ok) {
                         success[0]=true;
                         Map<String, Permission> newMap = user.newMap();
                         boolean willLog = aaf.access.willLog(Level.DEBUG);
-                        for(Perm perm : fp.value.getPerm()) {
+                        for (Perm perm : fp.value.getPerm()) {
                             user.add(newMap,new AAFPermission(perm.getNs(),perm.getType(),perm.getInstance(),perm.getAction(),perm.getRoles()));
-                            if(willLog) {
+                            if (willLog) {
                                 aaf.access.log(Level.DEBUG, name,"has '",perm.getType(),'|',perm.getInstance(),'|',perm.getAction(),'\'');
                             }
                         }
@@ -190,7 +195,7 @@ public class AAFLurPerm extends AbsAAFLur<AAFPermission> {
                 @Override
                 public Resp code(Rcli<?> client) throws CadiException, ConnectException, APIException {
                     final long remoteStart = System.nanoTime();
-                    Future<Perms> fp = aaf.client(Config.AAF_DEFAULT_VERSION).read(
+                    Future<Perms> fp = aaf.client().read(
                             "/authz/perms/user/"+name,
                             aaf.permsDF
                             );
@@ -198,13 +203,13 @@ public class AAFLurPerm extends AbsAAFLur<AAFPermission> {
                     // OK, done all we can, now get content
                     boolean ok = fp.get(aaf.timeout);
                     remote.set(Timing.millis(remoteStart));
-                    if(ok) {
+                    if (ok) {
                         success.set(true);
                         Map<String,Permission> newMap = user.newMap(); 
                         boolean willLog = aaf.access.willLog(Level.DEBUG);
-                        for(Perm perm : fp.value.getPerm()) {
+                        for (Perm perm : fp.value.getPerm()) {
                             user.add(newMap, new AAFPermission(perm.getNs(),perm.getType(),perm.getInstance(),perm.getAction(),perm.getRoles()));
-                            if(willLog) {
+                            if (willLog) {
                                 aaf.access.log(Level.DEBUG, name,"has",perm.getType(),perm.getInstance(),perm.getAction());
                             }
                         }