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"); }
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; }
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"); }
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"); }
public List<Privileges> getAllPrivileges() { logger.info( "List of all privileges got successfully in method getAllPrivileges() in class UsersServices"); return privilegesDAO.getAll(); }
public void setPrivileges(List<Privileges> list) { for (Privileges privileges : list) { privilegesDAO.update(privileges); } logger.info("Privileges set successfully in method setProvileges() in class UsersServices"); }