Skip to content
Snippets Groups Projects
Commit b9b4350e authored by Piotr Gawron's avatar Piotr Gawron
Browse files

unused getUserById method removed

parent 8eee25d6
No related branches found
No related tags found
1 merge request!346Resolve "LDAP authentication"
......@@ -155,15 +155,6 @@ public class UserService implements IUserService {
logService.log(params);
}
@Override
public User getUserById(int id) {
User result = userDao.getById(id);
if (result != null) {
userDao.refresh(result);
}
return result;
}
@Override
public User getUserByLogin(String login) {
User result = userDao.getUserByLogin(login);
......@@ -336,7 +327,7 @@ public class UserService implements IUserService {
Color colorMax = null;
Color colorSimple = null;
if (loggedUser != null) {
User dbUser = getUserById(loggedUser.getId());
User dbUser = getUserByLogin(loggedUser.getLogin());
if (dbUser != null) {
colorMin = dbUser.getMinColor();
colorMax = dbUser.getMaxColor();
......@@ -406,19 +397,6 @@ public class UserService implements IUserService {
}
}
@Override
public User getUserById(String creatorId, String authenticationToken) throws SecurityException {
User user = getUserByToken(authenticationToken);
Integer id = Integer.parseInt(creatorId);
if (user.getId().equals(id)) {
return user;
} else if (userHasPrivilege(authenticationToken, PrivilegeType.USER_MANAGEMENT)) {
return getUserById(id);
} else {
throw new SecurityException("You cannot access data of other users");
}
}
@Override
public List<User> getUsers(String token) throws SecurityException {
if (userHasPrivilege(token, PrivilegeType.USER_MANAGEMENT)) {
......
......@@ -119,16 +119,6 @@ public interface IUserService {
*/
void deleteUser(User user);
/**
* Returns user by the database identifier.
*
* @param id
* database identifier
* @return user for the given identifier, null if user doesn't exist
*
*/
User getUserById(int id);
/**
* Drops privileges for every user on the given object and type.
*
......@@ -175,8 +165,6 @@ public interface IUserService {
boolean userHasPrivilege(String token, PrivilegeType addMap) throws SecurityException;
User getUserById(String creatorId, String token) throws SecurityException;
List<User> getUsers(String token) throws SecurityException;
void setUserPrivilege(User modifiedUser, PrivilegeType type, Object privilegeToSet, String authenticationToken)
......
......@@ -212,10 +212,10 @@ public class UserServiceTest extends ServiceTestFunctions {
long logCount2 = logDao.getCount();
assertEquals("Log entry is missing for add user event", logCount + 1, logCount2);
userDao.evict(user2);
User user3 = userService.getUserById(user2.getId());
User user3 = userService.getUserByLogin(user2.getLogin());
assertNotNull(user3);
userService.deleteUser(user3);
user3 = userService.getUserById(user2.getId());
user3 = userService.getUserByLogin(user2.getLogin());
assertNull(user3);
long logCount3 = logDao.getCount();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment