@Test public void removeUserFromSuperadminTest() { com.intuit.wasabi.authenticationobjects.UserInfo uInfo = com.intuit.wasabi.authenticationobjects.UserInfo.newInstance( com.intuit.wasabi.authenticationobjects.UserInfo.Username. valueOf("test1")).build(); repository.removeUserFromSuperAdminRole(uInfo); verify(appRoleAccessor).deleteAppRoleBy( CassandraAuthorizationRepository.ALL_APPLICATIONS, "test1"); verify(userRoleAccessor).deleteUserRoleBy("test1", CassandraAuthorizationRepository.ALL_APPLICATIONS); }
@Override public void removeUserFromSuperAdminRole(UserInfo candidateUser) { LOGGER.debug("Removing user {} from user admin role", candidateUser); String userID = candidateUser.getUsername().toString(); userRoleAccessor.deleteUserRoleBy(userID, ALL_APPLICATIONS); appRoleAccessor.deleteAppRoleBy(ALL_APPLICATIONS, userID); }
CassandraAuthorizationRepository implements AuthorizationRepository { @Override public void removeUserFromSuperAdminRole(UserInfo candidateUser) { LOGGER.debug("Removing user {} from user admin role", candidateUser); String userID = candidateUser.getUsername().toString(); userRoleAccessor.deleteUserRoleBy(userID, ALL_APPLICATIONS); appRoleAccessor.deleteAppRoleBy(ALL_APPLICATIONS, userID); } }
CassandraAuthorizationRepository implements AuthorizationRepository { @Override public void removeUserFromSuperAdminRole(UserInfo candidateUser) { LOGGER.debug("Removing user {} from user admin role", candidateUser); String userID = candidateUser.getUsername().toString(); userRoleAccessor.deleteUserRoleBy(userID, ALL_APPLICATIONS); appRoleAccessor.deleteAppRoleBy(ALL_APPLICATIONS, userID); } @Inject  CassandraAuthorizationRepository(ApplicationListAccessor applicationListAccessor,
                                            AppRoleAccessor appRoleAccessor,
                                            UserRoleAccessor userRoleAccessor,
                                            UserInfoAccessor userInfoAccessor,
                                            UserDirectory userDirectory,
                                            MappingManager mappingManager); }
CassandraAuthorizationRepository implements AuthorizationRepository { @Override public void removeUserFromSuperAdminRole(UserInfo candidateUser) { LOGGER.debug("Removing user {} from user admin role", candidateUser); String userID = candidateUser.getUsername().toString(); userRoleAccessor.deleteUserRoleBy(userID, ALL_APPLICATIONS); appRoleAccessor.deleteAppRoleBy(ALL_APPLICATIONS, userID); } @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 removeUserFromSuperAdminRole(UserInfo candidateUser) { LOGGER.debug("Removing user {} from user admin role", candidateUser); String userID = candidateUser.getUsername().toString(); userRoleAccessor.deleteUserRoleBy(userID, ALL_APPLICATIONS); appRoleAccessor.deleteAppRoleBy(ALL_APPLICATIONS, userID); } @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; }