use of com.ramussoft.net.common.Group in project ramus by Vitaliy-Yakovchuk.
the class EditUsersDialog method updateGroup.
private void updateGroup(Group group) {
Group g = findGroup(group.getName(), groupsToUpdate);
if (g != null)
groupsToUpdate.remove(g);
groupsToUpdate.add(group);
}
use of com.ramussoft.net.common.Group in project ramus by Vitaliy-Yakovchuk.
the class EditUsersDialog method onOk.
protected void onOk() {
List<Group> grps = factory.getGroups();
for (Group group : groupsToUpdate) {
if (findGroup(group.getName(), grps) != null) {
factory.updateGroup(group);
} else {
factory.createGroup(group);
}
}
List<User> urs = factory.getUsers();
for (User user : usersToUpdate) {
if (findUser(user.getLogin(), urs) != null) {
factory.updateUser(user);
} else {
factory.createUser(user);
}
}
for (String group : groupsToDelete) {
factory.deleteGroup(group);
}
for (String user : usersToDelete) {
factory.deleteUser(user);
}
super.onOk();
}
use of com.ramussoft.net.common.Group in project ramus by Vitaliy-Yakovchuk.
the class DaoSupportImpl method loadUserByUsername.
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
com.ramussoft.net.common.User user = getUserFactory().getUser(username);
if (user == null) {
throw new UsernameNotFoundException(MessageFormat.format("User {0} not found", username));
}
List<Group> list = user.getGroups();
GrantedAuthority[] arrayAuths = new GrantedAuthority[list.size() + 1];
for (int i = 0; i < list.size(); i++) {
arrayAuths[i] = new GrantedAuthorityImpl("ROLE_" + list.get(i).getName().toUpperCase());
}
arrayAuths[list.size()] = new GrantedAuthorityImpl("ROLE_USER");
return new User(user.getLogin(), user.getPassword(), true, true, true, true, arrayAuths);
}
use of com.ramussoft.net.common.Group in project ramus by Vitaliy-Yakovchuk.
the class UserFactoryImpl method getGroup.
@Override
public Group getGroup(String groupName) {
Group group = new Group();
group.setName(groupName);
return group;
}
use of com.ramussoft.net.common.Group in project ramus by Vitaliy-Yakovchuk.
the class ClientServiceImpl method login.
@Override
public Long login(String login, String password) {
if (!Metadata.CORPORATE) {
if (server.getConnectionsCount() >= 3)
return -1l;
} else {
int cc = ServerConnection.getConnectionCount(EngineFactory.getPropeties());
if (cc >= 0) {
if (server.getConnectionsCount() >= cc)
return -1l;
}
}
User user = userFactory.getUser(login);
if (user == null)
return -1l;
if (!user.getPassword().equals(password))
user = null;
if (user == null)
return -1l;
this.user = user;
for (Group group : user.getGroups()) {
if (group.getName().equals("admin")) {
userFactoryClient.setAdmin(true);
break;
}
}
setLogin(login);
return 1l;
}
Aggregations