summaryrefslogtreecommitdiffstats
path: root/auth/auth-service/src/main
diff options
context:
space:
mode:
authorTomek Kaminski <tomasz.kaminski@nokia.com>2018-08-26 22:53:28 +0200
committerTomek Kaminski <tomasz.kaminski@nokia.com>2018-08-30 14:30:14 +0200
commita1c6eff4add57b70b2c22284d08441073ceaa3aa (patch)
tree6fab8d9252942050bda4483b9c3ed928b25b38bb /auth/auth-service/src/main
parent45ca42c48030171a5dcf180bb35fb767ae5c2b78 (diff)
Mapper_2_0 Junits
Junits for roles mapping Change-Id: I2d3ffd4b5adef6b164e096fda229d4e1b34be416 Issue-ID: AAF-450 Signed-off-by: Tomek Kaminski <tomasz.kaminski@nokia.com>
Diffstat (limited to 'auth/auth-service/src/main')
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/mapper/Mapper_2_0.java15
1 files changed, 4 insertions, 11 deletions
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/mapper/Mapper_2_0.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/mapper/Mapper_2_0.java
index 06278f92..f414a9fd 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/mapper/Mapper_2_0.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/mapper/Mapper_2_0.java
@@ -416,8 +416,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
public Result<Roles> roles(AuthzTrans trans, List<RoleDAO.Data> from, Roles to, boolean filter) {
final boolean needNS = trans.requested(REQD_TYPE.ns);
for(RoleDAO.Data frole : from) {
- // Only Add Data to view if User is allowed to see this Role
- //if(!filter || q.mayUserViewRole(trans, trans.user(), frole).isOK()) {
+ // Only Add Data to view if User is allowed to see this Role
if(!filter || q.mayUser(trans, trans.user(), frole,Access.read).isOK()) {
Role role = new Role();
role.setName(frole.ns + '.' + frole.name);
@@ -427,7 +426,8 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
}
for(String p : frole.perms(false)) { // can see any Perms in the Role he has permission for
Result<String[]> rpa = PermDAO.Data.decodeToArray(trans,q,p);
- if(rpa.notOK()) return Result.err(rpa);
+ if(rpa.notOK())
+ return Result.err(rpa);
String[] pa = rpa.value;
Pkey pKey = new Pkey();
@@ -481,12 +481,6 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
return Result.ok(to);
}
- /**
- *
- * @param base
- * @param start
- * @return
- */
@Override
public Result<UserRoleDAO.Data> userRole(AuthzTrans trans, Request base) {
try {
@@ -495,8 +489,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
// Setup UserRoleData, either for immediate placement, or for futureIt i
UserRoleDAO.Data to = new UserRoleDAO.Data();
if (from.getUser() != null) {
- String user = from.getUser();
- to.user = user;
+ to.user = from.getUser();
}
if (from.getRole() != null) {
to.role(trans,q,from.getRole());