NIHVIVO-2299 Remove User and UserDao, and make necessary changes.
This commit is contained in:
parent
5456227b04
commit
e11ffeaf62
29 changed files with 31 additions and 1589 deletions
|
@ -105,11 +105,11 @@
|
|||
</listener>
|
||||
|
||||
<!-- Update to the new UserAccounts model (1.3). Needs to run after JenaDataSourceSetup. -->
|
||||
<!-- <listener>
|
||||
<listener>
|
||||
<listener-class>
|
||||
edu.cornell.mannlib.vitro.webapp.servlet.setup.UpdateUserAccounts
|
||||
</listener-class>
|
||||
</listener> -->
|
||||
</listener>
|
||||
|
||||
<!-- Attaching submodels permits extra RDF files to be made visible without storing the data in the DB. -->
|
||||
<listener>
|
||||
|
@ -635,15 +635,6 @@
|
|||
<url-pattern>/keywordEdit</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>UserEditController</servlet-name>
|
||||
<servlet-class>edu.cornell.mannlib.vitro.webapp.controller.edit.UserEditController</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>UserEditController</servlet-name>
|
||||
<url-pattern>/userEdit</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>OntologyEditController</servlet-name>
|
||||
<servlet-class>edu.cornell.mannlib.vitro.webapp.controller.edit.OntologyEditController</servlet-class>
|
||||
|
@ -743,16 +734,6 @@
|
|||
<url-pattern>/addRestriction</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<!-- TODO This should go away as soon as the new UserAccounts are fully implemented. jblake -->
|
||||
<servlet>
|
||||
<servlet-name>UsersListingController</servlet-name>
|
||||
<servlet-class>edu.cornell.mannlib.vitro.webapp.controller.edit.listing.UsersListingController</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>UsersListingController</servlet-name>
|
||||
<url-pattern>/listUsers</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>AccountsAdmin</servlet-name>
|
||||
<servlet-class>edu.cornell.mannlib.vitro.webapp.controller.accounts.admin.UserAccountsAdminController</servlet-class>
|
||||
|
|
|
@ -1,137 +0,0 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.beans;
|
||||
|
||||
import java.text.Collator;
|
||||
import java.util.Date;
|
||||
|
||||
public class User implements Comparable<User> {
|
||||
|
||||
public final static int MIN_PASSWORD_LENGTH = 6;
|
||||
public final static int MAX_PASSWORD_LENGTH = 12;
|
||||
|
||||
private String URI = null;
|
||||
private String namespace = null;
|
||||
private String localName = null;
|
||||
private String username = null;
|
||||
private String oldPassword = null;
|
||||
private String md5password = null;
|
||||
private Date modTime = null;
|
||||
private Date firstTime = null;
|
||||
private int loginCount = 0;
|
||||
private String roleURI = null;
|
||||
private String lastName = null;
|
||||
private String firstName = null;
|
||||
|
||||
public String getURI() {
|
||||
return URI;
|
||||
}
|
||||
public void setURI(String URI) {
|
||||
this.URI = URI;
|
||||
}
|
||||
|
||||
public String getNamespace() {
|
||||
return namespace;
|
||||
}
|
||||
public void setNamespace(String namespace) {
|
||||
this.namespace = namespace;
|
||||
}
|
||||
|
||||
public String getLocalName() {
|
||||
return localName;
|
||||
}
|
||||
public void setLocalName(String localName) {
|
||||
this.localName = localName;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getOldPassword() {
|
||||
return oldPassword;
|
||||
}
|
||||
public void setOldPassword(String oldPassword) {
|
||||
this.oldPassword = oldPassword;
|
||||
}
|
||||
|
||||
public String getMd5password() {
|
||||
return md5password;
|
||||
}
|
||||
public void setMd5password(String md5password) {
|
||||
this.md5password = md5password;
|
||||
}
|
||||
|
||||
public Date getModTime() {
|
||||
return modTime;
|
||||
}
|
||||
public void setModTime(Date modTime) {
|
||||
this.modTime = modTime;
|
||||
}
|
||||
|
||||
public Date getFirstTime() {
|
||||
return firstTime;
|
||||
}
|
||||
public void setFirstTime(Date firstTime) {
|
||||
this.firstTime = firstTime;
|
||||
}
|
||||
|
||||
public int getLoginCount() {
|
||||
return loginCount;
|
||||
}
|
||||
public void setLoginCount(int loginCount) {
|
||||
this.loginCount = loginCount;
|
||||
}
|
||||
|
||||
public String getRoleURI() {
|
||||
return roleURI;
|
||||
}
|
||||
public void setRoleURI(String roleURI) {
|
||||
this.roleURI = roleURI;
|
||||
}
|
||||
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
public void setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(User other) {
|
||||
Collator collator = Collator.getInstance();
|
||||
if( this.getUsername() == null && other.getUsername() == null )
|
||||
return 0;
|
||||
else if( this.getUsername() == null )
|
||||
return -1;
|
||||
else if( other.getUsername() == null)
|
||||
return 1;
|
||||
else
|
||||
return collator.compare(this.getUsername(),other.getUsername());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "User[URI=" + URI + ", namespace=" + namespace + ", localName="
|
||||
+ localName + ", username=" + username + ", oldPassword="
|
||||
+ oldPassword + ", md5password=" + md5password + ", modTime="
|
||||
+ dateToString(modTime) + ", firstTime="
|
||||
+ dateToString(firstTime) + ", loginCount=" + loginCount
|
||||
+ ", roleURI=" + roleURI + ", lastName=" + lastName
|
||||
+ ", firstName=" + firstName + "]";
|
||||
}
|
||||
|
||||
private String dateToString(Date date) {
|
||||
return (date == null) ? "null" : String.valueOf(date.getTime());
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.controller;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -22,7 +23,8 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.UserDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.UserAccount;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.UserAccountsDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.email.FreemarkerEmailFactory;
|
||||
|
||||
public class MailUsersServlet extends VitroHttpServlet {
|
||||
|
@ -74,10 +76,8 @@ public class MailUsersServlet extends VitroHttpServlet {
|
|||
int recipientCount = 0;
|
||||
String deliveryfrom = null;
|
||||
|
||||
UserDao uDao = vreq.getFullWebappDaoFactory().getUserDao();
|
||||
|
||||
// get Individuals that the User mayEditAs
|
||||
deliverToArray = uDao.getUserAccountEmails();
|
||||
deliverToArray = getEmailsForAllUserAccounts(vreq);
|
||||
|
||||
//Removed all form type stuff b/c recipients pre-configured
|
||||
recipientCount=(deliverToArray == null) ? 0 : deliverToArray.size();
|
||||
|
@ -208,6 +208,18 @@ public class MailUsersServlet extends VitroHttpServlet {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
private List<String> getEmailsForAllUserAccounts(VitroRequest vreq) {
|
||||
UserAccountsDao uaDao = vreq.getFullWebappDaoFactory()
|
||||
.getUserAccountsDao();
|
||||
|
||||
List<String> emails = new ArrayList<String>();
|
||||
for (UserAccount user : uaDao.getAllUserAccounts()) {
|
||||
emails.add(user.getEmailAddress());
|
||||
}
|
||||
|
||||
return emails;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doPost( HttpServletRequest request, HttpServletResponse response )
|
||||
|
|
|
@ -9,15 +9,12 @@ import org.apache.commons.logging.Log;
|
|||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.User;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.UserAccount;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.accounts.UserAccountsPage;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.accounts.admin.UserAccountsEditPage;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.UserDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
|
||||
/**
|
||||
* Handle the "My Account" form display and submission.
|
||||
|
@ -57,7 +54,7 @@ public class UserAccountsMyAccountPage extends UserAccountsPage {
|
|||
public UserAccountsMyAccountPage(VitroRequest vreq) {
|
||||
super(vreq);
|
||||
|
||||
this.userAccount = getLoggedInUser();
|
||||
this.userAccount = LoginStatusBean.getCurrentUser(vreq);
|
||||
this.strategy = UserAccountsMyAccountPageStrategy.getInstance(vreq,
|
||||
this, isExternalAccount());
|
||||
|
||||
|
@ -111,25 +108,6 @@ public class UserAccountsMyAccountPage extends UserAccountsPage {
|
|||
return errorCode.isEmpty();
|
||||
}
|
||||
|
||||
private UserAccount getLoggedInUser() {
|
||||
// TODO This is a bogus measure.
|
||||
// TODO It only works because for now we are not deleting old User
|
||||
// structures, and there is a new UserAccount with email set to the old
|
||||
// User username.
|
||||
String uri = LoginStatusBean.getBean(vreq).getUserURI();
|
||||
WebappDaoFactory wdf = (WebappDaoFactory) this.ctx
|
||||
.getAttribute("webappDaoFactory");
|
||||
User u = wdf.getUserDao().getUserByURI(uri);
|
||||
|
||||
UserAccount ua = userAccountsDao.getUserAccountByEmail(u.getUsername());
|
||||
if (ua == null) {
|
||||
throw new IllegalStateException("Couldn't find a UserAccount "
|
||||
+ "for uri: '" + uri + "'");
|
||||
}
|
||||
log.debug("Logged-in user is " + ua);
|
||||
return ua;
|
||||
}
|
||||
|
||||
private boolean isExternalAccount() {
|
||||
return LoginStatusBean.getBean(vreq).hasExternalAuthentication();
|
||||
}
|
||||
|
|
|
@ -33,10 +33,9 @@ import com.hp.hpl.jena.rdf.model.StmtIterator;
|
|||
import com.hp.hpl.jena.shared.Lock;
|
||||
|
||||
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.UserAccount;
|
||||
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.UserDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
|
||||
|
@ -507,12 +506,14 @@ public class N3MultiPartUpload extends VitroHttpServlet {
|
|||
}
|
||||
|
||||
public void sendUserEmail(HttpServletRequest request, HttpSession session, String uploadFileName) {
|
||||
LoginStatusBean loginBean = LoginStatusBean.getBean(request);
|
||||
String userURI = loginBean.getUserURI();
|
||||
UserAccount userAccount = LoginStatusBean.getCurrentUser(request);
|
||||
if (userAccount == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try{
|
||||
System.out.println("User URI is " + userURI);
|
||||
UserDao uDao = (new VitroRequest(request)).getFullWebappDaoFactory().getUserDao();
|
||||
String email = uDao.getUserEmailAddress(userURI);
|
||||
System.out.println("User URI is " + userAccount.getUri());
|
||||
String email = userAccount.getEmailAddress();
|
||||
String deliveryFrom = "hjk54@cornell.edu";//TO DO: replace with email address to be used
|
||||
//Now send message
|
||||
MailUtil mu = new MailUtil(request);
|
||||
|
|
|
@ -1,138 +0,0 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.controller.edit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.ManageUserAccounts;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatementImpl;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.User;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.UserDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
|
||||
public class UserEditController extends BaseEditController {
|
||||
|
||||
private String[] roleNameStr = new String[51];
|
||||
private static final Log log = LogFactory.getLog(UserEditController.class.getName());
|
||||
|
||||
public UserEditController() {
|
||||
roleNameStr[1] = "self editor";
|
||||
roleNameStr[4] = "editor";
|
||||
roleNameStr[5] = "curator";
|
||||
roleNameStr[50] = "system administrator";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doPost (HttpServletRequest request, HttpServletResponse response) throws ServletException {
|
||||
if (!isAuthorizedToDisplayPage(request, response, new Actions(new ManageUserAccounts()))) {
|
||||
return;
|
||||
}
|
||||
|
||||
VitroRequest vreq = new VitroRequest(request);
|
||||
|
||||
UserDao uDao = vreq.getFullWebappDaoFactory().getUserDao();
|
||||
|
||||
String userURIStr = request.getParameter("uri");
|
||||
User u = null;
|
||||
|
||||
if (userURIStr == null) {
|
||||
throw new ServletException(this.getClass().getName()+" expects user URI in 'uri' request parameter");
|
||||
} else {
|
||||
u = uDao.getUserByURI(userURIStr);
|
||||
}
|
||||
|
||||
if (u == null) {
|
||||
throw new ServletException(this.getClass().getName()+" could not find user "+userURIStr);
|
||||
}
|
||||
|
||||
ArrayList<String> results = new ArrayList<String>();
|
||||
results.add("Email address");
|
||||
results.add("first name");
|
||||
results.add("last name");
|
||||
results.add("login count");
|
||||
results.add("role");
|
||||
|
||||
String EMPTY = "";
|
||||
|
||||
String usernameStr = (u.getUsername() != null) ? u.getUsername() : "";
|
||||
results.add(usernameStr);
|
||||
String firstNameStr = (u.getFirstName() != null) ? u.getFirstName() : EMPTY;
|
||||
results.add(firstNameStr);
|
||||
String lastNameStr = (u.getLastName() != null) ? u.getLastName() : EMPTY;
|
||||
results.add(lastNameStr);
|
||||
String loginCountStr = Integer.toString(u.getLoginCount());
|
||||
results.add(loginCountStr);
|
||||
String roleStr = "";
|
||||
try {
|
||||
roleStr = roleNameStr[Integer.decode(u.getRoleURI())];
|
||||
} catch (Exception e) {}
|
||||
results.add(roleStr);
|
||||
|
||||
request.setAttribute("results",results);
|
||||
|
||||
List<String> mayEditAsUris = uDao.getIndividualsUserMayEditAs(u.getURI());
|
||||
if( mayEditAsUris != null && mayEditAsUris.size() > 0 ){
|
||||
List<ObjectPropertyStatement> mayEditAsStmts =
|
||||
new ArrayList<ObjectPropertyStatement>(mayEditAsUris.size());
|
||||
for(String objURI: mayEditAsUris){
|
||||
Individual editAs = vreq.getFullWebappDaoFactory().getIndividualDao().getIndividualByURI(objURI);
|
||||
ObjectPropertyStatement stmt = new ObjectPropertyStatementImpl();
|
||||
stmt.setSubjectURI(u.getURI());
|
||||
stmt.setPropertyURI(VitroVocabulary.MAY_EDIT_AS);
|
||||
stmt.setObjectURI(objURI);
|
||||
stmt.setObject(editAs);
|
||||
mayEditAsStmts.add(stmt);
|
||||
}
|
||||
request.setAttribute("mayEditAsStmts", mayEditAsStmts);
|
||||
}
|
||||
|
||||
/* these are set so that we can use the PropertyEditLinks jsp tags */
|
||||
ObjectProperty prop = new ObjectProperty();
|
||||
prop.setURI(VitroVocabulary.MAY_EDIT_AS);
|
||||
request.setAttribute("mayEditObjProp",prop);
|
||||
Individual entity = new IndividualImpl();
|
||||
entity.setURI(u.getURI());
|
||||
request.setAttribute("entity", entity);
|
||||
|
||||
request.setAttribute("results", results);
|
||||
request.setAttribute("columncount", new Integer(5));
|
||||
request.setAttribute("suppressquery", "true");
|
||||
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
request.setAttribute("user", u);
|
||||
request.setAttribute("bodyJsp","/templates/edit/specific/user_edit.jsp");
|
||||
request.setAttribute("title","User Account Control Panel");
|
||||
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+vreq.getAppBean().getThemeDir()+"css/edit.css\"/>");
|
||||
|
||||
try {
|
||||
rd.forward(request, response);
|
||||
} catch (Exception e) {
|
||||
log.error(this.getClass().getName()+" could not forward to view.");
|
||||
log.error(e.getMessage());
|
||||
log.error(e.getStackTrace());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException {
|
||||
doPost(request,response);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,365 +0,0 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.controller.edit;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vedit.beans.EditProcessObject;
|
||||
import edu.cornell.mannlib.vedit.beans.FormObject;
|
||||
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
||||
import edu.cornell.mannlib.vedit.beans.Option;
|
||||
import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
||||
import edu.cornell.mannlib.vedit.forwarder.PageForwarder;
|
||||
import edu.cornell.mannlib.vedit.forwarder.impl.UrlForwarder;
|
||||
import edu.cornell.mannlib.vedit.listener.ChangeListener;
|
||||
import edu.cornell.mannlib.vedit.util.FormUtils;
|
||||
import edu.cornell.mannlib.vedit.validator.ValidationObject;
|
||||
import edu.cornell.mannlib.vedit.validator.Validator;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.ManageUserAccounts;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.User;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.authenticate.Authenticator;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.UserDao;
|
||||
|
||||
public class UserRetryController extends BaseEditController {
|
||||
|
||||
private static final String ROLE_PROTOCOL = "role:/"; // this is weird; need to revisit
|
||||
private static final Log log = LogFactory.getLog(UserRetryController.class.getName());
|
||||
|
||||
@Override
|
||||
public void doPost (HttpServletRequest req, HttpServletResponse response) {
|
||||
if (!isAuthorizedToDisplayPage(req, response, new Actions(new ManageUserAccounts()))) {
|
||||
return;
|
||||
}
|
||||
|
||||
VitroRequest request = new VitroRequest(req);
|
||||
|
||||
//create an EditProcessObject for this and put it in the session
|
||||
EditProcessObject epo = super.createEpo(request);
|
||||
epo.setDataAccessObject(request.getFullWebappDaoFactory().getVClassDao());
|
||||
|
||||
String action = null;
|
||||
if (epo.getAction() == null) {
|
||||
action = "insert";
|
||||
epo.setAction("insert");
|
||||
} else {
|
||||
action = epo.getAction();
|
||||
}
|
||||
|
||||
UserDao uDao = request.getFullWebappDaoFactory().getUserDao();
|
||||
epo.setDataAccessObject(uDao);
|
||||
|
||||
User userForEditing = null;
|
||||
if (!epo.getUseRecycledBean()){
|
||||
if (request.getParameter("uri") != null) {
|
||||
try {
|
||||
userForEditing = uDao.getUserByURI(request.getParameter("uri"));
|
||||
userForEditing.setRoleURI(ROLE_PROTOCOL+userForEditing.getRoleURI());
|
||||
action = "update";
|
||||
epo.setAction("udpate");
|
||||
} catch (NullPointerException e) {
|
||||
log.error("Need to implement 'record not found' error message.");
|
||||
}
|
||||
} else {
|
||||
userForEditing = new User();
|
||||
userForEditing.setRoleURI(ROLE_PROTOCOL+"1");
|
||||
}
|
||||
epo.setOriginalBean(userForEditing);
|
||||
} else {
|
||||
userForEditing = (User) epo.getNewBean();
|
||||
}
|
||||
|
||||
populateBeanFromParams(userForEditing, request);
|
||||
|
||||
//validators
|
||||
Validator v = new PairedPasswordValidator();
|
||||
HashMap<String, List<Validator>> validatorMap = new HashMap<String, List<Validator>>();
|
||||
List<Validator> vList = Collections.singletonList(v);
|
||||
validatorMap.put("Md5password", vList);
|
||||
validatorMap.put("passwordConfirmation", vList);
|
||||
epo.setValidatorMap(validatorMap);
|
||||
|
||||
//preprocessors
|
||||
|
||||
//set up any listeners
|
||||
epo.setChangeListenerList(Collections.singletonList(new UserPasswordChangeListener()));
|
||||
|
||||
//make a postinsert pageforwarder that will send us to a new class's fetch screen
|
||||
epo.setPostInsertPageForwarder(new UserInsertPageForwarder());
|
||||
//make a postdelete pageforwarder that will send us to the list of classes
|
||||
epo.setPostDeletePageForwarder(new UrlForwarder("listUsers"));
|
||||
|
||||
//set the getMethod so we can retrieve a new bean after we've inserted it
|
||||
try {
|
||||
Class<?>[] args = new Class[] {String.class};
|
||||
epo.setGetMethod(uDao.getClass().getDeclaredMethod("getUserByURI",args));
|
||||
} catch (NoSuchMethodException e) {
|
||||
log.error(this.getClass().getName()+" could not find the getVClassByURI method");
|
||||
}
|
||||
|
||||
HashMap<String, List<Option>> optionMap = new HashMap<String, List<Option>>();
|
||||
|
||||
LoginStatusBean loginBean = LoginStatusBean.getBean(request);
|
||||
List<Option> roleOptionList = new LinkedList<Option>();
|
||||
|
||||
/* bdc34: Datastar needs non-backend-editing users for logging in non-Cornell people*/
|
||||
/* SelfEditingPolicySetup.SELF_EDITING_POLICY_WAS_SETUP is set by the SelfEditingPolicySetup context listener */
|
||||
Option nonEditor = new Option(ROLE_PROTOCOL+1, "self editor");
|
||||
/* self editing should be displayed if we are editing a user account that is already
|
||||
* self-editing even if self editing is off. */
|
||||
roleOptionList.add(nonEditor);
|
||||
|
||||
Option editor = new Option(ROLE_PROTOCOL+4, "editor");
|
||||
editor.setSelected(userForEditing.getRoleURI().equals(editor.getValue()));
|
||||
Option curator = new Option(ROLE_PROTOCOL+5, "curator");
|
||||
curator.setSelected(userForEditing.getRoleURI().equals(curator.getValue()));
|
||||
Option administrator = new Option (ROLE_PROTOCOL+50, "system administrator");
|
||||
administrator.setSelected(userForEditing.getRoleURI().equals(administrator.getValue()));
|
||||
|
||||
roleOptionList.add(editor);
|
||||
roleOptionList.add(curator);
|
||||
roleOptionList.add(administrator);
|
||||
|
||||
optionMap.put("Role", roleOptionList);
|
||||
|
||||
FormObject foo = new FormObject();
|
||||
foo.setErrorMap(epo.getErrMsgMap());
|
||||
foo.setOptionLists(optionMap);
|
||||
epo.setFormObject(foo);
|
||||
|
||||
request.setAttribute("formValue",foo.getValues());
|
||||
|
||||
String html = FormUtils.htmlFormFromBean(userForEditing,action,foo,epo.getBadValueMap());
|
||||
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
request.setAttribute("formHtml",html);
|
||||
request.setAttribute("user",userForEditing);
|
||||
request.setAttribute("bodyJsp","/templates/edit/formBasic.jsp");
|
||||
if (userForEditing.getMd5password()==null || userForEditing.getMd5password().equals("")) {
|
||||
request.setAttribute("formOnSubmit", "return validatePw(this);");
|
||||
request.setAttribute("formOnCancel", "forceCancel(this.form);");
|
||||
}
|
||||
else {
|
||||
request.setAttribute("formOnSubmit", "return validateUserFields(this);");
|
||||
request.setAttribute("formOnCancel", "forceCancelTwo(this.form);");
|
||||
}
|
||||
|
||||
request.setAttribute("formJsp","/templates/edit/specific/user_retry.jsp");
|
||||
request.setAttribute("scripts","/templates/edit/specific/user_retry_head.jsp");
|
||||
request.setAttribute("title","User Account Editing Form");
|
||||
request.setAttribute("_action",action);
|
||||
request.setAttribute("unqualifiedClassName","User");
|
||||
setRequestAttributes(request,epo);
|
||||
|
||||
try {
|
||||
rd.forward(request, response);
|
||||
} catch (Exception e) {
|
||||
log.error(this.getClass().getName()+" could not forward to view.");
|
||||
log.error(e.getMessage());
|
||||
log.error(e.getStackTrace());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doGet (HttpServletRequest request, HttpServletResponse response) {
|
||||
doPost(request, response);
|
||||
}
|
||||
|
||||
class UserInsertPageForwarder implements PageForwarder {
|
||||
|
||||
@Override
|
||||
public void doForward(HttpServletRequest request, HttpServletResponse response, EditProcessObject epo){
|
||||
String newUserUrl = "userEdit?uri=";
|
||||
User u = (User) epo.getNewBean();
|
||||
try {
|
||||
newUserUrl += URLEncoder.encode(u.getURI(),"UTF-8");
|
||||
} catch (Exception e) {
|
||||
log.error(this.getClass().getName()+" could not use UTF-8 encoding to encode new URL");
|
||||
}
|
||||
try {
|
||||
response.sendRedirect(newUserUrl);
|
||||
} catch (IOException ioe) {
|
||||
log.error(this.getClass().getName()+" could not send redirect.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create one of these and assign it to both password fields.
|
||||
*/
|
||||
class PairedPasswordValidator implements Validator {
|
||||
private String otherValue;
|
||||
|
||||
/**
|
||||
* Validate the length of this password, and stash it for the other
|
||||
* validator to compare to.
|
||||
*
|
||||
* This relies on the fact that {@link #validate(Object)} will be called
|
||||
* once for each of the password fields.
|
||||
*/
|
||||
@Override
|
||||
public ValidationObject validate(Object value)
|
||||
throws IllegalArgumentException {
|
||||
log.trace("validate password pair: " + value + ", " + otherValue);
|
||||
|
||||
// Must be a non-null String
|
||||
if (!(value instanceof String)) {
|
||||
log.trace("not a string: " + value);
|
||||
return ValidationObject.failure(value, "Please enter a value");
|
||||
}
|
||||
|
||||
// Must be within the length limits.
|
||||
String string = (String) value;
|
||||
if ((string.length() < User.MIN_PASSWORD_LENGTH)
|
||||
|| (string.length() > User.MAX_PASSWORD_LENGTH)) {
|
||||
log.trace("bad length: " + value);
|
||||
return ValidationObject.failure(value,
|
||||
"Please enter a password between "
|
||||
+ User.MIN_PASSWORD_LENGTH + " and "
|
||||
+ User.MAX_PASSWORD_LENGTH
|
||||
+ " characters long.");
|
||||
}
|
||||
|
||||
// If we haven't validate the other yet, just store this value.
|
||||
if (otherValue == null) {
|
||||
log.trace("first of the pair: " + value);
|
||||
otherValue = string;
|
||||
return ValidationObject.success(value);
|
||||
}
|
||||
|
||||
// Compare this value to the stored one.
|
||||
String otherString = otherValue;
|
||||
otherValue = null;
|
||||
if (string.equals(otherString)) {
|
||||
log.trace("values are equal: " + value);
|
||||
return ValidationObject.success(value);
|
||||
} else {
|
||||
log.trace("values are not equal: " + value + ", " + otherValue);
|
||||
return ValidationObject.failure(value,
|
||||
"The passwords do not match.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* When a new password is created, encode it.
|
||||
*/
|
||||
class UserPasswordChangeListener implements ChangeListener {
|
||||
/**
|
||||
* Encode the password for a new user.
|
||||
*/
|
||||
@Override
|
||||
public void doInserted(Object newObj, EditProcessObject epo) {
|
||||
try {
|
||||
User newUser = convertToUser(newObj);
|
||||
UserDao userDao = getUserDaoFromEPO(epo);
|
||||
encodePasswordAndUpdateUser("insert", newUser, userDao);
|
||||
} catch (PwException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode the password for an updated user, if it has changed.
|
||||
*/
|
||||
@Override
|
||||
public void doUpdated(Object oldObj, Object newObj,
|
||||
EditProcessObject epo) {
|
||||
try {
|
||||
User newUser = convertToUser(newObj);
|
||||
User oldUser = convertToUser(oldObj);
|
||||
UserDao userDao = getUserDaoFromEPO(epo);
|
||||
if (passwordHasChanged(newUser, oldUser)) {
|
||||
encodePasswordAndUpdateUser("update", newUser, userDao);
|
||||
} else {
|
||||
log.debug("update: password has not changed.");
|
||||
}
|
||||
} catch (PwException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Do nothing for a deleted user.
|
||||
*/
|
||||
@Override
|
||||
public void doDeleted(Object oldObj, EditProcessObject epo) {
|
||||
log.debug("delete: nothing to do");
|
||||
}
|
||||
|
||||
private User convertToUser(Object o) throws PwException {
|
||||
if (o instanceof User) {
|
||||
return (User) o;
|
||||
} else {
|
||||
throw new PwException("Can't apply password encoding without a "
|
||||
+ "User object: " + o);
|
||||
}
|
||||
}
|
||||
|
||||
private UserDao getUserDaoFromEPO(EditProcessObject epo)
|
||||
throws PwException {
|
||||
if (epo == null) {
|
||||
throw new PwException(
|
||||
"Can't apply password encoding without an "
|
||||
+ "EditProcessObject");
|
||||
}
|
||||
|
||||
Object dao = epo.getDataAccessObject();
|
||||
|
||||
if (dao instanceof UserDao) {
|
||||
return (UserDao) dao;
|
||||
} else {
|
||||
throw new PwException(
|
||||
"Can't apply password encoding without a "
|
||||
+ "UserDao object: " + dao);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean passwordHasChanged(User newUser, User oldUser)
|
||||
throws PwException {
|
||||
String newPw = newUser.getMd5password();
|
||||
String oldPw = oldUser.getMd5password();
|
||||
if (newPw == null) {
|
||||
throw new PwException("Can't encode a null password");
|
||||
}
|
||||
return !newPw.equals(oldPw);
|
||||
}
|
||||
|
||||
private void encodePasswordAndUpdateUser(String action, User user, UserDao userDao) {
|
||||
String rawPassword = user.getMd5password();
|
||||
if (rawPassword == null) {
|
||||
log.error("Can't encode a null password");
|
||||
}
|
||||
|
||||
String encodedPassword = Authenticator.applyMd5Encoding(rawPassword);
|
||||
log.trace(action + ": Raw password '" + rawPassword
|
||||
+ "', encoded '" + encodedPassword + "'");
|
||||
|
||||
user.setMd5password(encodedPassword);
|
||||
|
||||
userDao.updateUser(user);
|
||||
}
|
||||
}
|
||||
|
||||
class PwException extends Exception {
|
||||
public PwException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,122 +0,0 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.controller.edit.listing;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.ManageUserAccounts;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.User;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.UserDao;
|
||||
|
||||
public class UsersListingController extends BaseEditController {
|
||||
public static final Actions REQUIRED_ACTIONS = new Actions(new ManageUserAccounts());
|
||||
|
||||
private String[] roleNameStr = new String[51];
|
||||
|
||||
public UsersListingController() {
|
||||
roleNameStr[1] = "self editor";
|
||||
roleNameStr[4] = "editor";
|
||||
roleNameStr[5] = "curator";
|
||||
roleNameStr[50] = "system administrator";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response) {
|
||||
if (!isAuthorizedToDisplayPage(request, response, REQUIRED_ACTIONS)) {
|
||||
return;
|
||||
}
|
||||
|
||||
VitroRequest vrequest = new VitroRequest(request);
|
||||
|
||||
UserDao dao = vrequest.getFullWebappDaoFactory().getUserDao();
|
||||
|
||||
List<User> users = dao.getAllUsers();
|
||||
Collections.sort(users);
|
||||
|
||||
ArrayList<String> results = new ArrayList<String>();
|
||||
results.add("XX");
|
||||
results.add("User");
|
||||
results.add("first name");
|
||||
results.add("last name");
|
||||
results.add("role");
|
||||
results.add("first login");
|
||||
results.add("login count");
|
||||
//results.add("recent edits"); // 2010-01-21 not currently supporting
|
||||
|
||||
Integer width = results.size();
|
||||
|
||||
String EMPTY = "";
|
||||
|
||||
if (users != null) {
|
||||
Iterator<User> userIt = users.iterator();
|
||||
while (userIt.hasNext()) {
|
||||
User user = userIt.next();
|
||||
results.add("XX");
|
||||
if (user.getUsername() != null) {
|
||||
try {
|
||||
results.add("<a href=\"./userEdit?uri="+URLEncoder.encode(user.getURI(),"UTF-8")+"\">"+user.getUsername()+"</a>");
|
||||
} catch (Exception e) {
|
||||
results.add(user.getUsername());
|
||||
}
|
||||
} else {
|
||||
results.add("");
|
||||
}
|
||||
String firstNameStr = (user.getFirstName() != null) ? user.getFirstName() : EMPTY;
|
||||
results.add(firstNameStr);
|
||||
String lastNameStr = (user.getLastName() != null) ? user.getLastName() : EMPTY;
|
||||
results.add(lastNameStr);
|
||||
String roleStr = "";
|
||||
try {
|
||||
roleStr = roleNameStr[Integer.decode(user.getRoleURI())];
|
||||
} catch (Exception e) {}
|
||||
results.add(roleStr);
|
||||
String firstLoginStr = "";
|
||||
try {
|
||||
firstLoginStr = (DISPLAY_DATE_FORMAT.format(user.getFirstTime()));
|
||||
} catch (Exception e) {}
|
||||
results.add(firstLoginStr);
|
||||
String loginCountStr = Integer.toString(user.getLoginCount());
|
||||
results.add(loginCountStr);
|
||||
// 2010-01-21 not currently supporting "recent edits"
|
||||
// try {
|
||||
// results.add("<a href=\"statementHistory?userURI="+URLEncoder.encode(user.getURI(),"UTF-8")+"\">recent edits</a>");
|
||||
// } catch (Exception e) {}
|
||||
|
||||
}
|
||||
request.setAttribute("results",results);
|
||||
}
|
||||
|
||||
request.setAttribute("columncount", width);
|
||||
request.setAttribute("suppressquery","true");
|
||||
request.setAttribute("title","User Accounts");
|
||||
request.setAttribute("bodyJsp", Controllers.HORIZONTAL_JSP);
|
||||
request.setAttribute("horizontalJspAddButtonUrl", Controllers.RETRY_URL);
|
||||
request.setAttribute("horizontalJspAddButtonText", "Add new user account");
|
||||
request.setAttribute("horizontalJspAddButtonControllerParam", "User");
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
try {
|
||||
rd.forward(request,response);
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response) {
|
||||
doGet(request,response);
|
||||
}
|
||||
|
||||
}
|
|
@ -24,7 +24,6 @@ import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.SeeSiteAdm
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseAdvancedDataToolsPages;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.edit.listing.UsersListingController;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.ParamMap;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||
|
@ -119,10 +118,6 @@ public class SiteAdminController extends FreemarkerHttpServlet {
|
|||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
Map<String, String> urls = new HashMap<String, String>();
|
||||
|
||||
// TODO remove this when the UserAccounts are fully implemented. -- jblake
|
||||
if (PolicyHelper.isAuthorizedForActions(vreq, UsersListingController.REQUIRED_ACTIONS)) {
|
||||
urls.put("users", urlBuilder.getPortalUrl("/listUsers"));
|
||||
}
|
||||
if (PolicyHelper.isAuthorizedForActions(vreq, new ManageUserAccounts())) {
|
||||
urls.put("userList", urlBuilder.getPortalUrl("/accountsAdmin"));
|
||||
}
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.dao;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.User;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface UserDao {
|
||||
|
||||
public User getUserByUsername(String username);
|
||||
|
||||
public User getUserByURI(String URI);
|
||||
|
||||
public List <User> getAllUsers();
|
||||
|
||||
public void updateUser(User user);
|
||||
|
||||
public String insertUser(User user);
|
||||
|
||||
public void deleteUser(User user);
|
||||
|
||||
public List<String> getIndividualsUserMayEditAs(String userURI);
|
||||
|
||||
public List<String> getUserAccountEmails();
|
||||
|
||||
public String getUserEmailAddress(String userURI);
|
||||
}
|
|
@ -169,17 +169,7 @@ public class VitroVocabulary {
|
|||
|
||||
// =============== Vitro User vocabulary =================================
|
||||
|
||||
// TODO - these go away when the UserAccount stuff is fully implemented - jblake
|
||||
public static final String USER = vitroURI+"User";
|
||||
public static final String USER_USERNAME = vitroURI+"username";
|
||||
public static final String USER_MD5PASSWORD = vitroURI+"md5password";
|
||||
public static final String USER_OLDPASSWORD = vitroURI+"oldpassword";
|
||||
public static final String USER_FIRSTTIME = vitroURI+"firstTime";
|
||||
public static final String USER_LOGINCOUNT = vitroURI+"loginCount";
|
||||
public static final String USER_ROLE = vitroURI+"roleURI";
|
||||
public static final String USER_LASTNAME = vitroURI+"lastName";
|
||||
public static final String USER_FIRSTNAME = vitroURI+"firstName";
|
||||
public static final String MAY_EDIT_AS = vitroURI+"mayEditAs";
|
||||
// public static final String MAY_EDIT_AS = vitroURI+"mayEditAs";
|
||||
|
||||
// =============== Vitro UserAccount and PermissionSet vocabulary ===========
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.dao;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
@ -118,9 +117,6 @@ public interface WebappDaoFactory {
|
|||
public LinksDao getLinksDao();
|
||||
public LinktypeDao getLinktypeDao();
|
||||
|
||||
// TODO This goes away when the UserAccounts stuff is fully implemented - jblake.
|
||||
public UserDao getUserDao();
|
||||
|
||||
public UserAccountsDao getUserAccountsDao();
|
||||
|
||||
public VClassGroupDao getVClassGroupDao();
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.dao.filtering;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.*;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.UserDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.filtering.filters.VitroFilters;
|
||||
import net.sf.jga.fn.UnaryFunctor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class UserDaoFiltering extends BaseFiltering implements UserDao{
|
||||
|
||||
private final UserDao innerDao;
|
||||
private final VitroFilters filters;
|
||||
|
||||
public UserDaoFiltering(UserDao userDao, VitroFilters filters) {
|
||||
this.innerDao = userDao;
|
||||
this.filters = filters;
|
||||
}
|
||||
|
||||
public List<User> getAllUsers() {
|
||||
return filter(innerDao.getAllUsers(),filters.getUserFilter());
|
||||
}
|
||||
|
||||
public User getUserByURI(String URI) {
|
||||
User u = innerDao.getUserByURI(URI);
|
||||
if( u != null && filters.getUserFilter().fn(u))
|
||||
return u;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public User getUserByUsername(String username) {
|
||||
User u = innerDao.getUserByUsername(username);
|
||||
if( u != null && filters.getUserFilter().fn(u))
|
||||
return u;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public void updateUser(User user) {
|
||||
innerDao.updateUser(user);
|
||||
}
|
||||
|
||||
public String insertUser(User user) {
|
||||
return innerDao.insertUser(user);
|
||||
}
|
||||
|
||||
public void deleteUser(User user) {
|
||||
innerDao.deleteUser(user);
|
||||
}
|
||||
|
||||
public List<String> getIndividualsUserMayEditAs(String userURI) {
|
||||
return innerDao.getIndividualsUserMayEditAs(userURI);
|
||||
}
|
||||
|
||||
public List<String> getUserAccountEmails() {
|
||||
return innerDao.getUserAccountEmails();
|
||||
}
|
||||
|
||||
public String getUserEmailAddress(String userURI) {
|
||||
return innerDao.getUserEmailAddress(userURI);
|
||||
}
|
||||
|
||||
}
|
|
@ -12,7 +12,6 @@ import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao;
|
|||
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyStatementDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DatatypeDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DisplayModelDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.FlagDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.KeywordDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.KeywordIndividualRelationDao;
|
||||
|
@ -27,7 +26,6 @@ import edu.cornell.mannlib.vitro.webapp.dao.PageDao;
|
|||
import edu.cornell.mannlib.vitro.webapp.dao.PropertyGroupDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.PropertyInstanceDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.UserAccountsDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.UserDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VClassGroupDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
|
@ -69,7 +67,6 @@ public class WebappDaoFactoryFiltering implements WebappDaoFactory {
|
|||
transient private ObjectPropertyStatementDao filteringObjectPropertyStatementDao=null;
|
||||
transient private VClassDao filteringVClassDao=null;
|
||||
|
||||
transient private UserDao filteringUserDao=null; // TODO This goes away when the UserAccounts stuff is fully implemented - jblake.
|
||||
transient private UserAccountsDao filteringUserAccountsDao=null;
|
||||
transient private VClassGroupDao filteringVClassGroupDao=null;
|
||||
transient private PropertyGroupDao filteringPropertyGroupDao=null;
|
||||
|
@ -128,14 +125,6 @@ public class WebappDaoFactoryFiltering implements WebappDaoFactory {
|
|||
return filteringIndividualDao;
|
||||
}
|
||||
|
||||
// TODO This goes away when the UserAccounts stuff is fully implemented - jblake.
|
||||
public UserDao getUserDao() {
|
||||
if( filteringUserDao == null)
|
||||
filteringUserDao =
|
||||
new UserDaoFiltering(innerWebappDaoFactory.getUserDao(),filters);
|
||||
return filteringUserDao;
|
||||
}
|
||||
|
||||
public UserAccountsDao getUserAccountsDao() {
|
||||
if( filteringUserAccountsDao == null)
|
||||
filteringUserAccountsDao =
|
||||
|
|
|
@ -9,38 +9,26 @@ import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
|||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.PropertyGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.User;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
|
||||
|
||||
public interface VitroFilters {
|
||||
|
||||
|
||||
public VitroFilters and(VitroFilters other);
|
||||
|
||||
public UnaryFunctor<Individual, Boolean> getIndividualFilter();
|
||||
|
||||
|
||||
public UnaryFunctor<DataProperty, Boolean> getDataPropertyFilter();
|
||||
|
||||
|
||||
public UnaryFunctor<ObjectProperty, Boolean> getObjectPropertyFilter();
|
||||
|
||||
|
||||
public UnaryFunctor<DataPropertyStatement, Boolean> getDataPropertyStatementFilter();
|
||||
|
||||
|
||||
public UnaryFunctor<ObjectPropertyStatement, Boolean> getObjectPropertyStatementFilter();
|
||||
|
||||
|
||||
public UnaryFunctor<VClass, Boolean> getClassFilter();
|
||||
|
||||
|
||||
public UnaryFunctor<VClassGroup, Boolean> getVClassGroupFilter();
|
||||
|
||||
// TODO This goes away when the UserAccounts stuff is fully implemented -- jb
|
||||
public UnaryFunctor<User, Boolean> getUserFilter();
|
||||
|
||||
|
||||
public UnaryFunctor<PropertyGroup, Boolean> getPropertyGroupFilter();
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ public abstract class VitroFiltersBase implements VitroFilters {
|
|||
AdaptorFunctors.and(this.getObjectPropertyStatementFilter(),other.getObjectPropertyStatementFilter()),
|
||||
AdaptorFunctors.and(this.getClassFilter(),other.getClassFilter()),
|
||||
AdaptorFunctors.and(this.getVClassGroupFilter(),other.getVClassGroupFilter()),
|
||||
AdaptorFunctors.and(this.getUserFilter(), other.getUserFilter()),
|
||||
AdaptorFunctors.and(this.getPropertyGroupFilter(), other.getPropertyGroupFilter())
|
||||
);
|
||||
}
|
||||
|
|
|
@ -10,9 +10,9 @@ import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
|||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.PropertyGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.User;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.User;
|
||||
|
||||
/**
|
||||
* A object to hold all the filters commonly used by the vitro webapp.
|
||||
|
@ -43,9 +43,6 @@ public class VitroFiltersImpl extends VitroFiltersBase {
|
|||
/** filter for VClassGroup objects */
|
||||
UnaryFunctor<VClassGroup,Boolean> vClassGroupFilter;
|
||||
|
||||
/** filter for User objects */
|
||||
UnaryFunctor<User,Boolean> userFilter;
|
||||
|
||||
/** fitler for PropertyGroup objects */
|
||||
UnaryFunctor<PropertyGroup, Boolean> propertyGroupFilter;
|
||||
|
||||
|
@ -64,7 +61,6 @@ public class VitroFiltersImpl extends VitroFiltersBase {
|
|||
objectPropertyStatementFilter= FILTER_OUT_NOTHING;
|
||||
classFilter= FILTER_OUT_NOTHING;
|
||||
vClassGroupFilter = FILTER_OUT_NOTHING;
|
||||
userFilter= FILTER_OUT_NOTHING;
|
||||
propertyGroupFilter = FILTER_OUT_NOTHING;
|
||||
}
|
||||
|
||||
|
@ -76,7 +72,6 @@ public class VitroFiltersImpl extends VitroFiltersBase {
|
|||
UnaryFunctor<ObjectPropertyStatement, Boolean> objectPropertyStatementFilter,
|
||||
UnaryFunctor<VClass, Boolean> classFilter,
|
||||
UnaryFunctor<VClassGroup, Boolean> classGroupFilter,
|
||||
UnaryFunctor<User, Boolean> userFilter,
|
||||
UnaryFunctor<PropertyGroup,Boolean>propertyGroupFilter) {
|
||||
super();
|
||||
this.individualFilter = individualFilter;
|
||||
|
@ -86,7 +81,6 @@ public class VitroFiltersImpl extends VitroFiltersBase {
|
|||
this.objectPropertyStatementFilter = objectPropertyStatementFilter;
|
||||
this.classFilter = classFilter;
|
||||
vClassGroupFilter = classGroupFilter;
|
||||
this.userFilter = userFilter;
|
||||
this.propertyGroupFilter = propertyGroupFilter;
|
||||
}
|
||||
|
||||
|
@ -180,18 +174,6 @@ public class VitroFiltersImpl extends VitroFiltersBase {
|
|||
return this;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see edu.cornell.mannlib.vitro.webapp.dao.filtering.VitroFilters#getUserFilter()
|
||||
*/
|
||||
public UnaryFunctor<User, Boolean> getUserFilter() {
|
||||
return userFilter;
|
||||
}
|
||||
|
||||
public VitroFilters setUserFilter(UnaryFunctor<User, Boolean> userFilter) {
|
||||
this.userFilter = userFilter;
|
||||
return this;
|
||||
}
|
||||
|
||||
public UnaryFunctor<PropertyGroup, Boolean> getPropertyGroupFilter() {
|
||||
return propertyGroupFilter;
|
||||
}
|
||||
|
|
|
@ -104,9 +104,6 @@ public class JenaBaseDaoCon {
|
|||
protected DatatypeProperty LINK_TYPE = _constModel.createDatatypeProperty(VitroVocabulary.LINK_TYPE);
|
||||
protected DatatypeProperty LINK_DISPLAYRANK = _constModel.createDatatypeProperty(VitroVocabulary.LINK_DISPLAYRANK_URL);
|
||||
|
||||
// TODO This goes away when the UserAccount stuff is fully implemented - jblake
|
||||
protected OntClass USER = _constModel.createClass(VitroVocabulary.USER);
|
||||
|
||||
// protected OntClass APPLICATION = null;
|
||||
// protected DatatypeProperty APPLICATION_FLAG1NAME = null;
|
||||
// protected DatatypeProperty APPLICATION_FLAG2NAME = null;
|
||||
|
|
|
@ -269,23 +269,4 @@ private final OntModelSpec DEFAULT_ONT_MODEL_SPEC = OntModelSpec.OWL_MEM;
|
|||
|
||||
}
|
||||
|
||||
public Model extractUserAccountsData(Model inputModel) {
|
||||
|
||||
Model userAccountsModel = ModelFactory.createDefaultModel();
|
||||
|
||||
String queryStr = makeDescribeQueryStr( VitroVocabulary.USER, null );
|
||||
|
||||
Query usersSparqlQuery = QueryFactory.create(queryStr);
|
||||
QueryExecution qe = QueryExecutionFactory.create(usersSparqlQuery,inputModel);
|
||||
try {
|
||||
inputModel.enterCriticalSection(Lock.READ);
|
||||
qe.execDescribe(userAccountsModel);
|
||||
} finally {
|
||||
inputModel.leaveCriticalSection();
|
||||
}
|
||||
|
||||
return userAccountsModel;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,329 +0,0 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.dao.jena;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.hp.hpl.jena.ontology.DatatypeProperty;
|
||||
import com.hp.hpl.jena.ontology.Individual;
|
||||
import com.hp.hpl.jena.ontology.OntClass;
|
||||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
import com.hp.hpl.jena.ontology.OntResource;
|
||||
import com.hp.hpl.jena.rdf.model.Literal;
|
||||
import com.hp.hpl.jena.rdf.model.Property;
|
||||
import com.hp.hpl.jena.rdf.model.RDFNode;
|
||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
||||
import com.hp.hpl.jena.rdf.model.Statement;
|
||||
import com.hp.hpl.jena.rdf.model.StmtIterator;
|
||||
import com.hp.hpl.jena.shared.Lock;
|
||||
import com.hp.hpl.jena.util.iterator.ClosableIterator;
|
||||
import com.hp.hpl.jena.vocabulary.RDF;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.User;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.UserDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
|
||||
public class UserDaoJena extends JenaBaseDao implements UserDao {
|
||||
|
||||
private static final String ROLE_PROTOCOL = "role:/";
|
||||
|
||||
public UserDaoJena(WebappDaoFactoryJena wadf) {
|
||||
super(wadf);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected OntModel getOntModel() {
|
||||
return getOntModelSelector().getUserAccountsModel();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<User> getAllUsers() {
|
||||
List<User> allUsersList = new ArrayList<User>();
|
||||
getOntModel().enterCriticalSection(Lock.READ);
|
||||
try {
|
||||
ClosableIterator userStmtIt = getOntModel().listStatements(null, RDF.type, USER);
|
||||
try {
|
||||
while (userStmtIt.hasNext()) {
|
||||
Statement stmt = (Statement) userStmtIt.next();
|
||||
OntResource subjRes = (OntResource) stmt.getSubject().as(OntResource.class);
|
||||
allUsersList.add(userFromUserInd(subjRes));
|
||||
}
|
||||
} finally {
|
||||
userStmtIt.close();
|
||||
}
|
||||
} finally {
|
||||
getOntModel().leaveCriticalSection();
|
||||
}
|
||||
return allUsersList;
|
||||
}
|
||||
|
||||
public User getUserByURI(String URI) {
|
||||
getOntModel().enterCriticalSection(Lock.READ);
|
||||
try {
|
||||
return userFromUserInd(getOntModel().getOntResource(URI));
|
||||
} finally {
|
||||
getOntModel().leaveCriticalSection();
|
||||
}
|
||||
}
|
||||
|
||||
public String insertUser(User user) {
|
||||
return insertUser(user,getOntModel());
|
||||
}
|
||||
|
||||
public String insertUser(User user, OntModel ontModel) {
|
||||
String userURI = null;
|
||||
ontModel.enterCriticalSection(Lock.WRITE);
|
||||
try {
|
||||
userURI = (user.getURI()==null) ? DEFAULT_NAMESPACE+user.getUsername().replaceAll("\\W","") : user.getURI();
|
||||
com.hp.hpl.jena.ontology.Individual test = ontModel.getIndividual(userURI);
|
||||
int count = 0;
|
||||
while (test != null) {
|
||||
++count;
|
||||
userURI+="_"+count;
|
||||
test = ontModel.getIndividual(userURI);
|
||||
}
|
||||
com.hp.hpl.jena.ontology.Individual userInd = ontModel.createIndividual(userURI, ontModel.getResource(USER.getURI()));
|
||||
addPropertyStringValue(userInd, ontModel.getProperty(VitroVocabulary.USER_USERNAME), user.getUsername(), ontModel);
|
||||
addPropertyStringValue(userInd, ontModel.getProperty(VitroVocabulary.USER_FIRSTNAME), user.getFirstName(), ontModel);
|
||||
addPropertyStringValue(userInd, ontModel.getProperty(VitroVocabulary.USER_LASTNAME), user.getLastName(), ontModel);
|
||||
addPropertyStringValue(userInd, ontModel.getProperty(VitroVocabulary.USER_MD5PASSWORD), user.getMd5password(), ontModel);
|
||||
addPropertyStringValue(userInd, ontModel.getProperty(VitroVocabulary.USER_ROLE), user.getRoleURI(), ontModel);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
ontModel.leaveCriticalSection();
|
||||
}
|
||||
user.setURI(userURI);
|
||||
return userURI;
|
||||
}
|
||||
|
||||
public void deleteUser(User user) {
|
||||
deleteUser(user,getOntModel());
|
||||
}
|
||||
|
||||
public void deleteUser(User user, OntModel ontModel) {
|
||||
ontModel.enterCriticalSection(Lock.WRITE);
|
||||
try {
|
||||
OntResource userRes = ontModel.getOntResource(user.getURI());
|
||||
if (userRes != null) {
|
||||
userRes.remove();
|
||||
}
|
||||
} finally {
|
||||
ontModel.leaveCriticalSection();
|
||||
}
|
||||
}
|
||||
|
||||
public User getUserByUsername(String username) {
|
||||
getOntModel().enterCriticalSection(Lock.READ);
|
||||
try {
|
||||
Property usernameProp = getOntModel().getProperty(VitroVocabulary.USER_USERNAME);
|
||||
Iterator stmtIt = getOntModel().listStatements(null, usernameProp, getOntModel().createTypedLiteral(username));
|
||||
if (stmtIt.hasNext()) {
|
||||
Statement stmt = (Statement) stmtIt.next();
|
||||
Individual userInd = getOntModel().getIndividual(stmt.getSubject().getURI());
|
||||
return userFromUserInd(userInd);
|
||||
} else {
|
||||
stmtIt = getOntModel().listStatements(null, usernameProp, getOntModel().createLiteral(username));
|
||||
if (stmtIt.hasNext()) {
|
||||
Statement stmt = (Statement) stmtIt.next();
|
||||
Individual userInd = getOntModel().getIndividual(stmt.getSubject().getURI());
|
||||
return userFromUserInd(userInd);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
getOntModel().leaveCriticalSection();
|
||||
}
|
||||
}
|
||||
|
||||
private User userFromUserInd(OntResource userInd) {
|
||||
User user = new User();
|
||||
user.setURI(userInd.getURI());
|
||||
user.setNamespace(userInd.getNameSpace());
|
||||
user.setLocalName(userInd.getLocalName());
|
||||
try {
|
||||
user.setUsername(((Literal)userInd.getProperty(getOntModel().getProperty(VitroVocabulary.USER_USERNAME)).getObject()).getString());
|
||||
} catch (Exception e) {}
|
||||
try {
|
||||
user.setMd5password(((Literal)userInd.getProperty(getOntModel().getProperty(VitroVocabulary.USER_MD5PASSWORD)).getObject()).getString());
|
||||
} catch (Exception e) {}
|
||||
try {
|
||||
user.setOldPassword(((Literal)userInd.getProperty(getOntModel().getProperty(VitroVocabulary.USER_OLDPASSWORD)).getObject()).getString());
|
||||
} catch (Exception e) {}
|
||||
try {
|
||||
user.setLoginCount(getPropertyNonNegativeIntValue(userInd,ResourceFactory.createProperty(VitroVocabulary.USER_LOGINCOUNT)));
|
||||
if (user.getLoginCount()<0) {
|
||||
user.setLoginCount(0);
|
||||
}
|
||||
} catch (Exception e) {e.printStackTrace();}
|
||||
try {
|
||||
user.setRoleURI(((Literal)userInd.getProperty(getOntModel().getProperty(VitroVocabulary.USER_ROLE)).getObject()).getString().substring(6));
|
||||
} catch (Exception e) {log.error("Unable to set user role\n");e.printStackTrace(); user.setRoleURI("1");} // TODO: fix this
|
||||
try {
|
||||
user.setLastName(((Literal)userInd.getProperty(getOntModel().getProperty(VitroVocabulary.USER_LASTNAME)).getObject()).getString());
|
||||
} catch (Exception e) {}
|
||||
try {
|
||||
user.setFirstName(((Literal)userInd.getProperty(getOntModel().getProperty(VitroVocabulary.USER_FIRSTNAME)).getObject()).getString());
|
||||
} catch (Exception e) {}
|
||||
try {
|
||||
user.setFirstTime(getPropertyDateTimeValue(userInd, getOntModel().getProperty(VitroVocabulary.vitroURI+"firstTime")));
|
||||
} catch (Exception e) {}
|
||||
return user;
|
||||
}
|
||||
|
||||
public void updateUser(User user) {
|
||||
updateUser(user,getOntModel());
|
||||
}
|
||||
|
||||
public void updateUser(User user, OntModel ontModel) {
|
||||
ontModel.enterCriticalSection(Lock.WRITE);
|
||||
try {
|
||||
OntResource userRes = ontModel.getOntResource(user.getURI());
|
||||
if (userRes != null) {
|
||||
updatePropertyStringValue(userRes, ontModel.getProperty(VitroVocabulary.USER_USERNAME), user.getUsername(), ontModel);
|
||||
updatePropertyStringValue(userRes, ontModel.getProperty(VitroVocabulary.USER_FIRSTNAME), user.getFirstName(), ontModel);
|
||||
updatePropertyStringValue(userRes, ontModel.getProperty(VitroVocabulary.USER_LASTNAME), user.getLastName(), ontModel);
|
||||
if (user.getRoleURI() != null && user.getRoleURI().indexOf(ROLE_PROTOCOL) != 0) {
|
||||
user.setRoleURI(ROLE_PROTOCOL+user.getRoleURI());
|
||||
}
|
||||
updatePropertyStringValue(userRes, ontModel.getProperty(VitroVocabulary.USER_ROLE), user.getRoleURI(), ontModel);
|
||||
updatePropertyStringValue(userRes, ontModel.getProperty(VitroVocabulary.USER_MD5PASSWORD), user.getMd5password(), ontModel);
|
||||
updatePropertyStringValue(userRes, ontModel.getProperty(VitroVocabulary.USER_OLDPASSWORD), user.getOldPassword(), ontModel);
|
||||
updatePropertyDateTimeValue(userRes, ontModel.getProperty(VitroVocabulary.USER_FIRSTTIME), user.getFirstTime(), ontModel);
|
||||
updatePropertyNonNegativeIntValue(userRes, ResourceFactory.createProperty(VitroVocabulary.USER_LOGINCOUNT), user.getLoginCount(), ontModel);
|
||||
} else {
|
||||
log.error("DEBUG UserDaoJena - "+user.getURI()+" not found");
|
||||
}
|
||||
} finally {
|
||||
ontModel.leaveCriticalSection();
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getIndividualsUserMayEditAs(String userURI) {
|
||||
List<String> uris = new ArrayList<String>();
|
||||
OntModel ontModel = getOntModel();
|
||||
ontModel.enterCriticalSection(Lock.READ);
|
||||
try{
|
||||
StmtIterator it = ontModel.listStatements(
|
||||
ontModel.createResource(userURI),
|
||||
ontModel.getProperty(VitroVocabulary.MAY_EDIT_AS),
|
||||
(RDFNode)null);
|
||||
while(it.hasNext()){
|
||||
try{
|
||||
Statement stmt = (Statement) it.next();
|
||||
if( stmt != null && stmt.getObject()!= null
|
||||
&& stmt.getObject().asNode() != null
|
||||
&& stmt.getObject().asNode().getURI() != null )
|
||||
uris.add(stmt.getObject().asNode().getURI());
|
||||
}catch(Exception ex){
|
||||
log.debug("error in getIndividualsUserMayEditAs()",ex);
|
||||
}
|
||||
}
|
||||
}finally{
|
||||
ontModel.leaveCriticalSection();
|
||||
}
|
||||
return uris;
|
||||
}
|
||||
|
||||
//Method to get all user accounts that are associated with a person where said person has email address
|
||||
public List<String> getUserAccountEmails() {
|
||||
List<String> email = new ArrayList<String>();
|
||||
List<String> uris = new ArrayList<String>();
|
||||
OntModel ontModel = getOntModel();
|
||||
OntModel baseModel = getOntModelSelector().getFullModel();
|
||||
ontModel.enterCriticalSection(Lock.READ);
|
||||
String swrcOntology = "http://swrc.ontoware.org/ontology#";
|
||||
String emailProperty = swrcOntology + "email";
|
||||
String emailValue, uri;
|
||||
try{
|
||||
Property emailProp = ontModel.getProperty(emailProperty);
|
||||
StmtIterator it = ontModel.listStatements(
|
||||
null,
|
||||
ontModel.getProperty(VitroVocabulary.MAY_EDIT_AS),
|
||||
(RDFNode)null);
|
||||
while(it.hasNext()){
|
||||
try{
|
||||
Statement stmt = (Statement) it.next();
|
||||
if( stmt != null && stmt.getObject()!= null
|
||||
&& stmt.getObject().asNode() != null
|
||||
&& stmt.getObject().asNode().getURI() != null )
|
||||
{
|
||||
|
||||
uri = stmt.getObject().asNode().getURI();
|
||||
StmtIterator emailIt = baseModel.listStatements(baseModel.createResource(uri), baseModel.createProperty(emailProperty), (RDFNode) null);
|
||||
while(emailIt.hasNext()) {
|
||||
Statement emailSt = (Statement) emailIt.next();
|
||||
if(emailSt != null && emailSt.getObject().isLiteral() && emailSt.getObject() != null) {
|
||||
email.add(emailSt.getLiteral().getString());
|
||||
//Issue: this prints out the email in a tags
|
||||
} else {
|
||||
//System.out.println("Unfortunately email statement is null");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}catch(Exception ex){
|
||||
log.debug("error in get User Account Emails()",ex);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}finally{
|
||||
ontModel.leaveCriticalSection();
|
||||
}
|
||||
return email;
|
||||
}
|
||||
|
||||
//for a specific user account, get the email address
|
||||
public String getUserEmailAddress(String userURI) {
|
||||
OntModel ontModel = getOntModel();
|
||||
OntModel baseModel = getOntModelSelector().getFullModel();
|
||||
ontModel.enterCriticalSection(Lock.READ);
|
||||
String swrcOntology = "http://swrc.ontoware.org/ontology#";
|
||||
String emailProperty = swrcOntology + "email";
|
||||
String personUri, emailValue = "";
|
||||
|
||||
try {
|
||||
//Get person account associated with this email address
|
||||
StmtIterator it = ontModel.listStatements(
|
||||
ontModel.createResource(userURI),
|
||||
ontModel.getProperty(VitroVocabulary.MAY_EDIT_AS),
|
||||
(RDFNode)null);
|
||||
try{
|
||||
while(it.hasNext()) {
|
||||
Statement personStmt = (Statement) it.next();
|
||||
if(personStmt != null
|
||||
&& personStmt.getObject() != null
|
||||
&& personStmt.getObject().asNode() != null
|
||||
&& personStmt.getObject().asNode().getURI() != null) {
|
||||
personUri = personStmt.getObject().asNode().getURI();
|
||||
|
||||
StmtIterator emailIt = baseModel.listStatements(baseModel.createResource(personUri),
|
||||
baseModel.createProperty(emailProperty),
|
||||
(RDFNode)null);
|
||||
while(emailIt.hasNext()) {
|
||||
Statement emailStmt = (Statement) emailIt.next();
|
||||
if(emailStmt != null && emailStmt.getObject().isLiteral() && emailStmt.getObject() != null) {
|
||||
emailValue = emailStmt.getLiteral().getString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch(Exception ex) {
|
||||
System.out.println("Error occurred in retrieving email and/or user uri");
|
||||
}
|
||||
}finally{
|
||||
ontModel.leaveCriticalSection();
|
||||
}
|
||||
return emailValue;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -55,14 +55,12 @@ import edu.cornell.mannlib.vitro.webapp.dao.PageDao;
|
|||
import edu.cornell.mannlib.vitro.webapp.dao.PropertyGroupDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.PropertyInstanceDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.UserAccountsDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.UserDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VClassGroupDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.pellet.PelletListener;
|
||||
import edu.cornell.mannlib.vitro.webapp.servlet.setup.JenaDataSourceSetupBase;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.PropertyGroupDaoJena;
|
||||
|
||||
public class WebappDaoFactoryJena implements WebappDaoFactory {
|
||||
|
||||
|
@ -73,7 +71,6 @@ public class WebappDaoFactoryJena implements WebappDaoFactory {
|
|||
protected LinksDao linksDao;
|
||||
protected LinktypeDao linktypeDao;
|
||||
protected ApplicationDaoJena applicationDao;
|
||||
protected UserDao userDao; // TODO This goes away when the UserAccounts stuff is fully implemented -- jb
|
||||
protected UserAccountsDao userAccountsDao;
|
||||
protected VClassGroupDao vClassGroupDao;
|
||||
protected PropertyGroupDao propertyGroupDao;
|
||||
|
@ -496,14 +493,6 @@ public class WebappDaoFactoryJena implements WebappDaoFactory {
|
|||
return propertyGroupDao = new PropertyGroupDaoJena(this);
|
||||
}
|
||||
|
||||
// TODO This goes away when the UserAccounts stuff is fully implemented -- jb
|
||||
public UserDao getUserDao() {
|
||||
if (userDao != null)
|
||||
return userDao;
|
||||
else
|
||||
return userDao = new UserDaoJena(this);
|
||||
}
|
||||
|
||||
public UserAccountsDao getUserAccountsDao() {
|
||||
if (userAccountsDao != null)
|
||||
return userAccountsDao;
|
||||
|
|
|
@ -356,24 +356,6 @@ public class JenaDataSourceSetup extends JenaDataSourceSetupBase implements java
|
|||
// Nothing to do.
|
||||
}
|
||||
|
||||
private void checkMainModelForUserAccounts(OntModel mainModel, OntModel userAccountsModel) {
|
||||
Model extractedUserData = ((new JenaModelUtils()).extractUserAccountsData(mainModel));
|
||||
if (extractedUserData.size() > 0) {
|
||||
userAccountsModel.enterCriticalSection(Lock.WRITE);
|
||||
try {
|
||||
userAccountsModel.add(extractedUserData);
|
||||
} finally {
|
||||
userAccountsModel.leaveCriticalSection();
|
||||
}
|
||||
mainModel.enterCriticalSection(Lock.WRITE);
|
||||
try {
|
||||
mainModel.remove(extractedUserData);
|
||||
} finally {
|
||||
mainModel.leaveCriticalSection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private OntModel ontModelFromContextAttribute(ServletContext ctx, String attribute) {
|
||||
OntModel ontModel;
|
||||
Object attributeValue = ctx.getAttribute(attribute);
|
||||
|
|
|
@ -7,8 +7,6 @@ import java.sql.SQLException;
|
|||
import java.util.Set;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.commons.dbcp.BasicDataSource;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
@ -19,13 +17,11 @@ import com.hp.hpl.jena.graph.Graph;
|
|||
import com.hp.hpl.jena.ontology.OntModelSpec;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.rdf.model.ModelFactory;
|
||||
import com.hp.hpl.jena.rdf.model.Resource;
|
||||
import com.hp.hpl.jena.sdb.StoreDesc;
|
||||
import com.hp.hpl.jena.sdb.store.DatabaseType;
|
||||
import com.hp.hpl.jena.sdb.store.LayoutType;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.JenaBaseDaoCon;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.RDBGraphGenerator;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.RegeneratingGraph;
|
||||
|
@ -350,37 +346,6 @@ public class JenaDataSourceSetupBase extends JenaBaseDaoCon {
|
|||
else
|
||||
return defaultformat;
|
||||
}
|
||||
/**
|
||||
* If the {@link ConfigurationProperties} has a name for the initial admin
|
||||
* user, create the user and add it to the model.
|
||||
*/
|
||||
protected void createInitialAdminUser(Model model, ServletContext ctx) {
|
||||
String initialAdminUsername = ConfigurationProperties
|
||||
.getBean(ctx).getProperty("initialAdminUser");
|
||||
if (initialAdminUsername == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// A hard-coded MD5 encryption of "defaultAdmin"
|
||||
String initialAdminPassword = "22BA075EC8951A70960A0A95C0BC2294";
|
||||
|
||||
String vitroDefaultNs = DEFAULT_DEFAULT_NAMESPACE;
|
||||
|
||||
Resource user = model.createResource(vitroDefaultNs
|
||||
+ "defaultAdminUser");
|
||||
model.add(model.createStatement(user, model
|
||||
.createProperty(VitroVocabulary.RDF_TYPE), model
|
||||
.getResource(VitroVocabulary.USER)));
|
||||
model.add(model.createStatement(user, model
|
||||
.createProperty(VitroVocabulary.USER_USERNAME), model
|
||||
.createTypedLiteral(initialAdminUsername)));
|
||||
model.add(model.createStatement(user, model
|
||||
.createProperty(VitroVocabulary.USER_MD5PASSWORD), model
|
||||
.createTypedLiteral(initialAdminPassword)));
|
||||
model.add(model.createStatement(user, model
|
||||
.createProperty(VitroVocabulary.USER_ROLE), model
|
||||
.createTypedLiteral("role:/50")));
|
||||
}
|
||||
|
||||
protected final static String DB_TYPE = "MySQL";
|
||||
private static VitroJenaModelMaker vjmm = null;
|
||||
|
|
|
@ -12,11 +12,7 @@ import org.apache.commons.logging.LogFactory;
|
|||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.rdf.model.ModelFactory;
|
||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
||||
import com.hp.hpl.jena.util.iterator.ClosableIterator;
|
||||
import com.hp.hpl.jena.vocabulary.RDF;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.ModelSynchronizer;
|
||||
|
||||
public class JenaPersistentDataSourceSetup extends JenaDataSourceSetupBase
|
||||
|
@ -41,9 +37,6 @@ public class JenaPersistentDataSourceSetup extends JenaDataSourceSetupBase
|
|||
firstStartup = true;
|
||||
readOntologyFilesInPathSet(AUTHPATH, sce.getServletContext(),
|
||||
userAccountsDbModel);
|
||||
if (userAccountsDbModel.size() == 0) {
|
||||
createInitialAdminUser(userAccountsDbModel, ctx);
|
||||
}
|
||||
}
|
||||
OntModel userAccountsModel = ModelFactory.createOntologyModel(
|
||||
MEM_ONT_MODEL_SPEC);
|
||||
|
@ -85,9 +78,6 @@ public class JenaPersistentDataSourceSetup extends JenaDataSourceSetupBase
|
|||
private void initializeUserAccounts(ServletContext ctx,
|
||||
Model userAccountsModel) {
|
||||
readOntologyFilesInPathSet(AUTHPATH, ctx, userAccountsModel);
|
||||
if (userAccountsModel.size() == 0) {
|
||||
createInitialAdminUser(userAccountsModel, ctx);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -200,8 +200,6 @@ public class VitroFiltersFactoryTest {
|
|||
Assert.assertNotNull("getObjectPropertyFilter was null", vf.getObjectPropertyFilter());
|
||||
Assert.assertNotNull("getObjectPropertyStatementFilter was null", vf.getObjectPropertyStatementFilter());
|
||||
Assert.assertNotNull("getIndividualFilter was null", vf.getIndividualFilter());
|
||||
//Assert.assertNotNull("getTabFilter was null", vf.getTabFilter());
|
||||
Assert.assertNotNull("getUserFilter was null", vf.getUserFilter());
|
||||
Assert.assertNotNull("getVClassGroupFilter was null", vf.getVClassGroupFilter());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,83 +0,0 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package stubs.edu.cornell.mannlib.vitro.webapp.dao;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.User;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.UserDao;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
public class UserDaoStub implements UserDao {
|
||||
// ----------------------------------------------------------------------
|
||||
// Stub infrastructure
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
private final Map<String, User> userByUriMap = new HashMap<String, User>();
|
||||
|
||||
public void addUser(User user) {
|
||||
userByUriMap.put(user.getURI(), user);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Stub methods
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public User getUserByURI(String URI) {
|
||||
return userByUriMap.get(URI);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Un-implemented methods
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public User getUserByUsername(String username) {
|
||||
throw new RuntimeException(
|
||||
"UserDaoStub.getUserByUsername() not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<User> getAllUsers() {
|
||||
throw new RuntimeException("UserDaoStub.getAllUsers() not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUser(User user) {
|
||||
throw new RuntimeException("UserDaoStub.updateUser() not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String insertUser(User user) {
|
||||
throw new RuntimeException("UserDaoStub.insertUser() not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteUser(User user) {
|
||||
throw new RuntimeException("UserDaoStub.deleteUser() not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getIndividualsUserMayEditAs(String userURI) {
|
||||
throw new RuntimeException(
|
||||
"UserDaoStub.getIndividualsUserMayEditAs() not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getUserAccountEmails() {
|
||||
throw new RuntimeException(
|
||||
"UserDaoStub.getUserAccountEmails() not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserEmailAddress(String userURI) {
|
||||
throw new RuntimeException(
|
||||
"UserDaoStub.getUserEmailAddress() not implemented.");
|
||||
}
|
||||
|
||||
}
|
|
@ -26,7 +26,6 @@ import edu.cornell.mannlib.vitro.webapp.dao.PageDao;
|
|||
import edu.cornell.mannlib.vitro.webapp.dao.PropertyGroupDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.PropertyInstanceDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.UserAccountsDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.UserDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VClassGroupDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
|
@ -264,9 +263,4 @@ public class WebappDaoFactoryStub implements WebappDaoFactory {
|
|||
throw new RuntimeException("WebappDaoFactory.close() not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserDao getUserDao() {
|
||||
throw new RuntimeException("WebappDaoFactory.getUserDao() not implemented.");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,97 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||
|
||||
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:c="http://java.sun.com/jsp/jstl/core" version="2.0">
|
||||
|
||||
<jsp:directive.page import="edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary"/>
|
||||
<jsp:directive.page import="edu.cornell.mannlib.vitro.webapp.beans.User"/>
|
||||
|
||||
<%@taglib prefix="vitro" uri="/WEB-INF/tlds/VitroUtils.tld" %>
|
||||
<%@page import="edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.ManageUserAccounts" %>
|
||||
<% request.setAttribute("requestedActions", new ManageUserAccounts()); %>
|
||||
<vitro:confirmAuthorization />
|
||||
|
||||
|
||||
<div class="editingForm">
|
||||
|
||||
<jsp:include page="/templates/edit/fetch/vertical.jsp"/>
|
||||
|
||||
<div align="center">
|
||||
<table class="form-background" border="0" cellpadding="2" cellspacing="2">
|
||||
<tr align="center">
|
||||
<td valign="bottom">
|
||||
<form action="listUsers" method="get">
|
||||
<input type="submit" class="form-button" value="See All User Accounts"/>
|
||||
</form>
|
||||
</td>
|
||||
<td valign="bottom" align="center">
|
||||
<form action="editForm" method="get">
|
||||
<input name="uri" type = "hidden" value="${user.URI}" />
|
||||
<input type="submit" class="form-button" value="Edit User Account"/>
|
||||
<input type="hidden" name="controller" value="User"/>
|
||||
</form>
|
||||
<form action="editForm" method="get">
|
||||
<input name="uri" type = "hidden" value="${user.URI}" />
|
||||
<input name="Md5password" type="hidden" value=""/>
|
||||
<input name="OldPassword" type="hidden" value=""/>
|
||||
<input type="submit" class="form-button" value="Reset Password"/>
|
||||
<input type="hidden" name="controller" value="User"/>
|
||||
</form>
|
||||
</td>
|
||||
<td valign="bottom">
|
||||
<form action="editForm" method="get">
|
||||
<input type="hidden" name="controller" value="User"/>
|
||||
<input type="submit" class="form-button" value="Add New User Account"/>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<c:if test="${application.selfEditingPolicyWasSetup}"> <!-- test="${requestScope.user.roleURI == 1 }"> -->
|
||||
|
||||
<h3 class="associate">Associate user account with a person</h3>
|
||||
<table class="form-background" border="0" cellpadding="2" cellspacing="2">
|
||||
<c:if test="${requestScope.mayEditAsStmts != null }">
|
||||
<c:forEach items="${requestScope.mayEditAsStmts }" var="stmt">
|
||||
<c:url var="deleteUrl" value="/edit/editRequestDispatch.jsp">
|
||||
<c:param name="subjectUri">${user.URI}</c:param>
|
||||
<c:param name="predicateUri">${stmt.propertyURI}</c:param>
|
||||
<c:param name="objectUri">${stmt.objectURI}</c:param>
|
||||
<c:param name="editform">admin/mayEditAs.jsp</c:param>
|
||||
</c:url>
|
||||
<tr>
|
||||
<td>
|
||||
<c:if test="${stmt.object == null or empty stmt.object.name }">
|
||||
<c:set var="associatedIndividual" value="${stmt.objectURI}" />
|
||||
</c:if>
|
||||
<c:if test="${stmt.object != null and !empty stmt.object.name }">
|
||||
<c:set var="associatedIndividual" value="${stmt.object.name}" />
|
||||
</c:if>
|
||||
${associatedIndividual} -- <a href="${deleteUrl}">Change or Remove Association</a>
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
<tr><td><em class="note">Note: <c:if test="${requestScope.user.roleURI == 1 }">This association allows the user to edit this person and be redirected to the person's profile when logging in.</c:if><c:if test="${requestScope.user.roleURI != 1 }">This association will result in the user being redirected to the person's profile when logging in.</c:if></em></td></tr>
|
||||
</c:if>
|
||||
|
||||
<c:if test="${requestScope.mayEditAsStmts == null }">
|
||||
<tr>
|
||||
<td>
|
||||
<c:url var="addUrl" value="/edit/editRequestDispatch.jsp">
|
||||
<c:param name="subjectUri">${user.URI}</c:param>
|
||||
<c:param name="editform">admin/mayEditAs.jsp</c:param>
|
||||
</c:url>
|
||||
This user account is not associated with a person -- <a href="${addUrl}">Select a person</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><em class="note">Note: <c:if test="${requestScope.user.roleURI == 1 }">Until an association is made, the self editor has no permissions to edit. Associating this user account to a person allows the user to edit this person and be redirected to the person's profile when logging in.</c:if><c:if test="${requestScope.user.roleURI != 1 }">Associating this user account to a person will result in the user being redirected to the person's profile when logging in.</c:if></em></td>
|
||||
</tr>
|
||||
</c:if>
|
||||
|
||||
</table>
|
||||
|
||||
</c:if>
|
||||
</div>
|
||||
</div>
|
||||
</jsp:root>
|
|
@ -17,8 +17,8 @@
|
|||
<li><a href="${siteConfig.urls.menuN3Editor}">Menu management</a></li>
|
||||
</#if>
|
||||
|
||||
<#if siteConfig.urls.users??>
|
||||
<li><a href="${siteConfig.urls.users}">User accounts</a></li>
|
||||
<#if siteConfig.urls.userList??>
|
||||
<li><a href="${siteConfig.urls.userList}">User accounts</a></li>
|
||||
</#if>
|
||||
|
||||
</ul>
|
||||
|
|
Loading…
Add table
Reference in a new issue