@Test public void assignUserToSuperadminTest() { com.intuit.wasabi.authenticationobjects.UserInfo uInfo = com.intuit.wasabi.authenticationobjects.UserInfo.newInstance( com.intuit.wasabi.authenticationobjects.UserInfo.Username. valueOf("test1")).build(); repository.assignUserToSuperAdminRole(uInfo); verify(appRoleAccessor).insertAppRoleBy( CassandraAuthorizationRepository.ALL_APPLICATIONS, "test1", CassandraAuthorizationRepository.SUPERADMIN); verify(userRoleAccessor).insertUserRoleBy("test1", CassandraAuthorizationRepository.ALL_APPLICATIONS, CassandraAuthorizationRepository.SUPERADMIN); }
@Override public void assignUserToSuperAdminRole(UserInfo candidateUser) { LOGGER.debug("Adding user {} as superadmin", candidateUser); String superAdminRole = Role.SUPERADMIN.toString().toLowerCase(); String userID = candidateUser.getUsername().toString(); userRoleAccessor.insertUserRoleBy(userID, ALL_APPLICATIONS, superAdminRole); appRoleAccessor.insertAppRoleBy(ALL_APPLICATIONS, userID, superAdminRole); }
CassandraAuthorizationRepository implements AuthorizationRepository { @Override public void assignUserToSuperAdminRole(UserInfo candidateUser) { LOGGER.debug("Adding user {} as superadmin", candidateUser); String superAdminRole = Role.SUPERADMIN.toString().toLowerCase(); String userID = candidateUser.getUsername().toString(); userRoleAccessor.insertUserRoleBy(userID, ALL_APPLICATIONS, superAdminRole); appRoleAccessor.insertAppRoleBy(ALL_APPLICATIONS, userID, superAdminRole); } }
CassandraAuthorizationRepository implements AuthorizationRepository { @Override public void assignUserToSuperAdminRole(UserInfo candidateUser) { LOGGER.debug("Adding user {} as superadmin", candidateUser); String superAdminRole = Role.SUPERADMIN.toString().toLowerCase(); String userID = candidateUser.getUsername().toString(); userRoleAccessor.insertUserRoleBy(userID, ALL_APPLICATIONS, superAdminRole); appRoleAccessor.insertAppRoleBy(ALL_APPLICATIONS, userID, superAdminRole); } @Inject  CassandraAuthorizationRepository(ApplicationListAccessor applicationListAccessor,
                                            AppRoleAccessor appRoleAccessor,
                                            UserRoleAccessor userRoleAccessor,
                                            UserInfoAccessor userInfoAccessor,
                                            UserDirectory userDirectory,
                                            MappingManager mappingManager); }
CassandraAuthorizationRepository implements AuthorizationRepository { @Override public void assignUserToSuperAdminRole(UserInfo candidateUser) { LOGGER.debug("Adding user {} as superadmin", candidateUser); String superAdminRole = Role.SUPERADMIN.toString().toLowerCase(); String userID = candidateUser.getUsername().toString(); userRoleAccessor.insertUserRoleBy(userID, ALL_APPLICATIONS, superAdminRole); appRoleAccessor.insertAppRoleBy(ALL_APPLICATIONS, userID, superAdminRole); } @Inject  CassandraAuthorizationRepository(ApplicationListAccessor applicationListAccessor,
                                            AppRoleAccessor appRoleAccessor,
                                            UserRoleAccessor userRoleAccessor,
                                            UserInfoAccessor userInfoAccessor,
                                            UserDirectory userDirectory,
                                            MappingManager mappingManager); @Override UserPermissionsList getUserPermissionsList(UserInfo.Username userID); @Override UserRoleList getApplicationUsers(Application.Name applicationName); @Override UserPermissions getUserPermissions(@Nonnull UserInfo.Username username,
                                              @Nonnull Application.Name applicationName); @Override void deleteUserRole(UserInfo.Username userID, Application.Name applicationName); @Override void setUserRole(UserRole userRole); @Override UserRoleList getUserRoleList(UserInfo.Username userID); @Override UserInfo getUserInfo(UserInfo.Username userID); @Override void setUserInfo(UserInfo userInfo); @Override UserPermissions checkSuperAdminPermissions(UserInfo.Username userID, Application.Name applicationName); @Override void assignUserToSuperAdminRole(UserInfo candidateUser); @Override void removeUserFromSuperAdminRole(UserInfo candidateUser); @Override List<UserRole> getSuperAdminRoleList(); }
CassandraAuthorizationRepository implements AuthorizationRepository { @Override public void assignUserToSuperAdminRole(UserInfo candidateUser) { LOGGER.debug("Adding user {} as superadmin", candidateUser); String superAdminRole = Role.SUPERADMIN.toString().toLowerCase(); String userID = candidateUser.getUsername().toString(); userRoleAccessor.insertUserRoleBy(userID, ALL_APPLICATIONS, superAdminRole); appRoleAccessor.insertAppRoleBy(ALL_APPLICATIONS, userID, superAdminRole); } @Inject  CassandraAuthorizationRepository(ApplicationListAccessor applicationListAccessor,
                                            AppRoleAccessor appRoleAccessor,
                                            UserRoleAccessor userRoleAccessor,
                                            UserInfoAccessor userInfoAccessor,
                                            UserDirectory userDirectory,
                                            MappingManager mappingManager); @Override UserPermissionsList getUserPermissionsList(UserInfo.Username userID); @Override UserRoleList getApplicationUsers(Application.Name applicationName); @Override UserPermissions getUserPermissions(@Nonnull UserInfo.Username username,
                                              @Nonnull Application.Name applicationName); @Override void deleteUserRole(UserInfo.Username userID, Application.Name applicationName); @Override void setUserRole(UserRole userRole); @Override UserRoleList getUserRoleList(UserInfo.Username userID); @Override UserInfo getUserInfo(UserInfo.Username userID); @Override void setUserInfo(UserInfo userInfo); @Override UserPermissions checkSuperAdminPermissions(UserInfo.Username userID, Application.Name applicationName); @Override void assignUserToSuperAdminRole(UserInfo candidateUser); @Override void removeUserFromSuperAdminRole(UserInfo candidateUser); @Override List<UserRole> getSuperAdminRoleList(); static final String ALL_APPLICATIONS; }