public void addNewUser(SecurityUserInterface user) { string sult = hashWorker.getSult(user); int id = DataSetConverter.fromDsToSingle.toInt.convert( SqlLiteSimpleExecute.execute(queryConfigurator.getUserId(user.getLogin()))); SqlLiteSimpleExecute.execute(queryConfigurator.setSult(id, sult)); SqlLiteSimpleExecute.execute(queryConfigurator.setPassword(id, hashWorker.getHash(user.getPassword(), sult))); InformationPopupWindow view = new InformationPopupWindow(); InformationPopupWindowConfig config = new InformationPopupWindowConfig( "Пользователь: " + user.getLogin() + " успешно добавлен!"); view.setConfig(config); view.show(); }
public void addNewUser(SecurityUserInterface user) { string sult = hashWorker.getSult(user); if (currentUser.isAdmin()) { //Проверка, есть ли уже такой пользователь FromDataSetToString newConverter = new FromDataSetToString(); if (newConverter.convert(configProxyForLoadDataFromBDAndExecute( queryConfigurator.getSult( currentUser.getLogin()))) == null) { configProxyForLoadDataFromBDAndExecute(queryConfigurator.addNewUser( user.getLogin(), hashWorker.getHash(user.getPassword(), sult), sult, user.isAdmin())); InformationPopupWindow view = new InformationPopupWindow(); InformationPopupWindowConfig config = new InformationPopupWindowConfig( "Пользователь: " + user.getLogin() + " успешно добавлен!"); view.setConfig(config); view.show(); } else { InformationPopupWindow view = new InformationPopupWindow(); InformationPopupWindowConfig config = new InformationPopupWindowConfig( "Логин: " + user.getLogin() + " был ранее добавлен в систему, " + "пожалуйста, придумайте другой"); view.setConfig(config); view.show(); } } else { throw new InsufficientPermissionsException("This user does not" + "have sufficient rights to perform the specified operation"); } }