@Test public void getRolesForUserOverEntity() { EUser u = userRepository.save(EntityUtil.getSampleUser(random.nextString())); assertNotNull(u); EOwnedEntity e = entityRepository.save(EntityUtil.getSampleEntity(random.nextString())); assertNotNull(e); BRole r1 = roleRepository.save(EntityUtil.getSampleRole(random.nextString())); assertNotNull(r1); BRole r2 = roleRepository.save(EntityUtil.getSampleRole(random.nextString())); assertNotNull(r2); BAuthorization.BAuthorizationPk pk1 = new BAuthorization.BAuthorizationPk(u.getId(), e.getId(), r1.getId()); BAuthorization auth1 = authorizationRepository.save(new BAuthorization(pk1, u, e, r1)); assertNotNull(auth1); BAuthorization.BAuthorizationPk pk2 = new BAuthorization.BAuthorizationPk(u.getId(), e.getId(), r2.getId()); BAuthorization auth2 = authorizationRepository.save(new BAuthorization(pk2, u, e, r2)); assertNotNull(auth2); try { final List<BRole> roles = userService.getRolesForUserOverEntity(u.getId(), e.getId()); assertNotNull(roles); assertFalse(roles.isEmpty()); assertTrue(roles.contains(r1)); assertTrue(roles.contains(r2)); } catch (NotFoundEntityException ex) { LOGGER.error(ex.getLocalizedMessage()); fail("Either the username or the entity was not found"); } }
public List<BRole> getRolesForUserOverEntity(final Long userId, final Long entityId) throws NotFoundEntityException { return authorizationRepository.getRolesForUserOverEntity( getUser(userId).getId(), getOwnedEntity(entityId).getId() ); }
UserService implements UserDetailsService { public List<BRole> getRolesForUserOverEntity(final Long userId, final Long entityId) throws NotFoundEntityException { return authorizationRepository.getRolesForUserOverEntity( getUser(userId).getId(), getOwnedEntity(entityId).getId() ); } }
UserService implements UserDetailsService { public List<BRole> getRolesForUserOverEntity(final Long userId, final Long entityId) throws NotFoundEntityException { return authorizationRepository.getRolesForUserOverEntity( getUser(userId).getId(), getOwnedEntity(entityId).getId() ); }  }
UserService implements UserDetailsService { public List<BRole> getRolesForUserOverEntity(final Long userId, final Long entityId) throws NotFoundEntityException { return authorizationRepository.getRolesForUserOverEntity( getUser(userId).getId(), getOwnedEntity(entityId).getId() ); }  EUser createDefaultUser(); EUser signUp(final EUser u, final EmailStatus emailStatus); EUser signUp(final EUser u, final EmailStatus emailStatus,
                        final RegistrationPrivilege registrationPrivilege); List<Long> addRolesToUser(final Long userId, final Long entityId,
                                     final Iterable<Long> rolesId); List<Long> removeRolesFromUser(final Long userId, final Long entityId, final Iterable<Long> rolesId); @Override UserDetails loadUserByUsername(final String usernameOrEmail); String getUserAuthoritiesForToken(final String usernameOrEmail, final String separator); Map<String, List<BRole>> getRolesForUser(final Long id); List<BRole> getRolesForUserOverEntity(final Long userId, final Long entityId); Long getEntityIdByUser(final EUser u); }
UserService implements UserDetailsService { public List<BRole> getRolesForUserOverEntity(final Long userId, final Long entityId) throws NotFoundEntityException { return authorizationRepository.getRolesForUserOverEntity( getUser(userId).getId(), getOwnedEntity(entityId).getId() ); }  EUser createDefaultUser(); EUser signUp(final EUser u, final EmailStatus emailStatus); EUser signUp(final EUser u, final EmailStatus emailStatus,
                        final RegistrationPrivilege registrationPrivilege); List<Long> addRolesToUser(final Long userId, final Long entityId,
                                     final Iterable<Long> rolesId); List<Long> removeRolesFromUser(final Long userId, final Long entityId, final Iterable<Long> rolesId); @Override UserDetails loadUserByUsername(final String usernameOrEmail); String getUserAuthoritiesForToken(final String usernameOrEmail, final String separator); Map<String, List<BRole>> getRolesForUser(final Long id); List<BRole> getRolesForUserOverEntity(final Long userId, final Long entityId); Long getEntityIdByUser(final EUser u);  }