Ejemplo n.º 1
0
 public void changeUserPrivileges(int privilegesId, int id) {
   Users user = usersDAO.get(id);
   user.setPrivilegesByPrivilegeId(privilegesDAO.get(privilegesId));
   usersDAO.update(user);
   logger.info(
       "User's privileges changed successfully in method changeUserPrivileges() in class UsersServices");
 }
Ejemplo n.º 2
0
 public Privileges getPrivilegeByName(String name) {
   for (Privileges privileges : privilegesDAO.getAll()) {
     if (privileges.getName().equals(name)) {
       return privileges;
     }
   }
   logger.info("Privilege got successfully in method getPrivilegeByName() in class UsersServices");
   return null;
 }
Ejemplo n.º 3
0
 public void addUser(
     int privilegeId,
     String login,
     String password,
     String email,
     String firstName,
     String lastName) {
   Users user = new Users();
   user.setLogin(login);
   user.setPassword(password);
   user.setEmail(email);
   user.setFirstName(firstName);
   user.setLastName(lastName);
   user.setPrivilegesByPrivilegeId(privilegesDAO.get(privilegeId));
   usersDAO.create(user);
   logger.info("User added successfully in method addUser() in class UsersServices");
 }
Ejemplo n.º 4
0
 public void editUserInfo(
     int id,
     String login,
     String password,
     String email,
     String firstName,
     String lastName,
     Integer privilegeId) {
   Users user = usersDAO.get(id);
   user.setLogin(login);
   user.setPassword(password);
   user.setEmail(email);
   user.setFirstName(firstName);
   user.setLastName(lastName);
   user.setPrivilegesByPrivilegeId(privilegesDAO.get(privilegeId));
   usersDAO.update(user);
   logger.info("User's info changed successfully in method editUserInfo() in class UsersServices");
 }
Ejemplo n.º 5
0
 public List<Privileges> getAllPrivileges() {
   logger.info(
       "List of all privileges got successfully in method getAllPrivileges() in class UsersServices");
   return privilegesDAO.getAll();
 }
Ejemplo n.º 6
0
 public void setPrivileges(List<Privileges> list) {
   for (Privileges privileges : list) {
     privilegesDAO.update(privileges);
   }
   logger.info("Privileges set successfully in method setProvileges() in class UsersServices");
 }