use of com.ramussoft.net.common.User 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.User in project ramus by Vitaliy-Yakovchuk.
the class ServerIEngineImpl method transformStreamName.
private String transformStreamName(String oldPath) {
if (oldPath.startsWith(USER)) {
if (serverAccessRules == null) {
return oldPath;
}
String end = oldPath.substring(USER.length() - 1);
User user = serverAccessRules.getUser();
if ("admin".equals(user.getLogin()))
return oldPath;
String login = user.getLogin();
return USER + login + end;
}
return oldPath;
}
use of com.ramussoft.net.common.User in project ramus by Vitaliy-Yakovchuk.
the class UserFactoryImpl method getUser.
@Override
public User getUser(final String login) {
return (User) template.execute(new JDBCCallback() {
@Override
public Object execute(Connection connection) throws SQLException {
PreparedStatement selUser = connection.prepareStatement("SELECT * FROM USERS WHERE \"login\"=?");
selUser.setString(1, login);
ResultSet rs = selUser.executeQuery();
PreparedStatement groupQualifiers = template.getConnection().prepareStatement("SELECT qualifier_id FROM group_qualifier_access WHERE group_name=? ORDER BY qualifier_id");
if (rs.next()) {
PreparedStatement groups = connection.prepareStatement("SELECT * FROM users_groups WHERE \"login\"=? ORDER BY group_name");
User user = createUser(groups, rs, groupQualifiers);
groups.close();
rs.close();
selUser.close();
return user;
}
rs.close();
groupQualifiers.close();
selUser.close();
return null;
}
});
}
use of com.ramussoft.net.common.User in project ramus by Vitaliy-Yakovchuk.
the class ClientServiceImpl method changePassword.
@Override
public void changePassword(String newPassword) {
User me = me();
if (me == null)
return;
me.setPassword(newPassword);
userFactory.updateUser(me);
}
use of com.ramussoft.net.common.User 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