@Override public void recoverPassword(String name, String newPassword) throws Exception { try { String id = "org.couchdb.user:"+name; JSONObject userDoc = userDb.getDocument(id); userDb.computeUserPassword(userDoc, newPassword); userDb.updateDocument(userDoc); } catch(Exception e) { throw new Exception("Unable to update password: "+name); } }
@Override public void createUser(JSONObject userDoc) throws Exception { userDb.createDocument(userDoc); }
if( null != userDb ){ try { userDesignDocument = userDb.getDesignDocument("nunaliit_user"); } catch (Exception e) { throw new ServletException("Unable to create user design document.",e); CouchDbSecurityDocument securityDoc = userDb.getSecurityDocument(); Collection<String> adminRoles = securityDoc.getAdminRoles(); userDb.setSecurityDocument(securityDoc);
@Override public CouchAuthenticationContext getUserFromName(String userName) throws Exception { CouchUserDb userDb = getClient().getUserDatabase(); return userDb.getUserFromName(userName); } }
Collection<JSONObject> userDocs = userDb.getDocuments(docIds); for(String id : docIds){ try { JSONObject userDoc = userDb.getDocument(id); if( null != userDoc ){ tempUserDocs.add(userDoc);
@Override public void computeUserPassword(JSONObject userDoc, String password) throws Exception { userDb.computeUserPassword(userDoc, password); } }
@Override public JSONObject getUserFromId(String id) throws Exception { return userDb.getDocument(id); }
throw new ServletException("Unable to connect to _users database",e); logger.info("User database configured: "+userDb.getUrl());
userDb.getChangeMonitor().shutdown(); } catch(Exception e) { logger.error("Unable to shutdown change monitor on user database", e);
public AgreementRobotThread(AgreementRobotSettings settings) throws Exception { this.atlasName = settings.getAtlasName(); this.documentDbDesignDocument = settings.getDocumentDesignDocument(); this.userDbDesignDocument = settings.getUserDb().getDesignDocument("nunaliit_user"); agreementRole = "nunaliit_agreement_atlas"; if( null != atlasName ){ agreementRole = "nunaliit_agreement_" + atlasName; } noWorkDelay = DELAY_NO_WORK_POLLING; CouchDbChangeMonitor changeMonitor = documentDbDesignDocument.getDatabase().getChangeMonitor(); if( null != changeMonitor ){ noWorkDelay = DELAY_NO_WORK_MONITOR; changeMonitor.addChangeListener(this); } }
if( null != userId ){ try { userDocContext = userDb.getUserFromName(userId); } catch(Exception e) {