NIHVIVO-2690 Root user should not receive the "no profile" message.
This commit is contained in:
parent
cd099505a6
commit
1ffe229a30
5 changed files with 26 additions and 8 deletions
|
@ -96,8 +96,9 @@ public abstract class Authenticator {
|
||||||
* <pre>
|
* <pre>
|
||||||
* Record that the user has logged in, with all of the housekeeping that
|
* Record that the user has logged in, with all of the housekeeping that
|
||||||
* goes with it:
|
* goes with it:
|
||||||
* - updating the user record
|
* - update the user record
|
||||||
* - setting login status and timeout limit in the session
|
* - set login status and timeout limit in the session
|
||||||
|
* - refresh the Identifiers on the request
|
||||||
* - record the user in the session map
|
* - record the user in the session map
|
||||||
* - notify other users of the model
|
* - notify other users of the model
|
||||||
* </pre>
|
* </pre>
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
||||||
import edu.cornell.mannlib.vedit.beans.LoginStatusBean.AuthenticationSource;
|
import edu.cornell.mannlib.vedit.beans.LoginStatusBean.AuthenticationSource;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.auth.identifier.RequestIdentifiers;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean.RoleLevel;
|
import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean.RoleLevel;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.SelfEditingConfiguration;
|
import edu.cornell.mannlib.vitro.webapp.beans.SelfEditingConfiguration;
|
||||||
|
@ -125,6 +126,7 @@ public class BasicAuthenticator extends Authenticator {
|
||||||
|
|
||||||
HttpSession session = request.getSession();
|
HttpSession session = request.getSession();
|
||||||
createLoginStatusBean(userAccount.getUri(), authSource, session);
|
createLoginStatusBean(userAccount.getUri(), authSource, session);
|
||||||
|
RequestIdentifiers.resetIdentifiers(request);
|
||||||
setSessionTimeoutLimit(userAccount, session);
|
setSessionTimeoutLimit(userAccount, session);
|
||||||
recordInUserSessionMap(userAccount.getUri(), session);
|
recordInUserSessionMap(userAccount.getUri(), session);
|
||||||
notifyOtherUsers(userAccount.getUri(), session);
|
notifyOtherUsers(userAccount.getUri(), session);
|
||||||
|
|
|
@ -16,6 +16,10 @@ import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.auth.identifier.RequestIdentifiers;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.auth.identifier.common.HasRoleLevel;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.auth.identifier.common.IsRootUser;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean.RoleLevel;
|
import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean.RoleLevel;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.DisplayMessage;
|
import edu.cornell.mannlib.vitro.webapp.beans.DisplayMessage;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.UserAccount;
|
import edu.cornell.mannlib.vitro.webapp.beans.UserAccount;
|
||||||
|
@ -152,7 +156,12 @@ public class LoginRedirector {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isMerelySelfEditor() {
|
private boolean isMerelySelfEditor() {
|
||||||
RoleLevel role = RoleLevel.getRoleFromLoginStatus(request);
|
IdentifierBundle ids = RequestIdentifiers.getIdBundleForRequest(request);
|
||||||
|
if (IsRootUser.isRootUser(ids)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
RoleLevel role = HasRoleLevel.getUsersRoleLevel(ids);
|
||||||
return role == RoleLevel.PUBLIC || role == RoleLevel.SELF;
|
return role == RoleLevel.PUBLIC || role == RoleLevel.SELF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,8 @@ import stubs.javax.servlet.http.HttpSessionStub;
|
||||||
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
||||||
import edu.cornell.mannlib.vedit.beans.LoginStatusBean.AuthenticationSource;
|
import edu.cornell.mannlib.vedit.beans.LoginStatusBean.AuthenticationSource;
|
||||||
import edu.cornell.mannlib.vitro.testing.AbstractTestClass;
|
import edu.cornell.mannlib.vitro.testing.AbstractTestClass;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.auth.identifier.ActiveIdentifierBundleFactories;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.auth.identifier.common.CommonIdentifierBundleFactory;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.UserAccount;
|
import edu.cornell.mannlib.vitro.webapp.beans.UserAccount;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.authenticate.Authenticator;
|
import edu.cornell.mannlib.vitro.webapp.controller.authenticate.Authenticator;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.authenticate.AuthenticatorStub;
|
import edu.cornell.mannlib.vitro.webapp.controller.authenticate.AuthenticatorStub;
|
||||||
|
@ -143,6 +145,9 @@ public class AuthenticateTest extends AbstractTestClass {
|
||||||
|
|
||||||
auth = new Authenticate();
|
auth = new Authenticate();
|
||||||
auth.init(servletConfig);
|
auth.init(servletConfig);
|
||||||
|
|
||||||
|
ActiveIdentifierBundleFactories.addFactory(servletContext,
|
||||||
|
new CommonIdentifierBundleFactory(servletContext));
|
||||||
}
|
}
|
||||||
|
|
||||||
private UserAccount createUserFromUserInfo(UserInfo userInfo) {
|
private UserAccount createUserFromUserInfo(UserInfo userInfo) {
|
||||||
|
|
|
@ -38,6 +38,12 @@ public class UserAccountsDaoStub implements UserAccountsDao {
|
||||||
return userAccountsByUri.get(uri);
|
return userAccountsByUri.get(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRootUser(UserAccount userAccount) {
|
||||||
|
// TODO for now, no user is Root
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Un-implemented methods
|
// Un-implemented methods
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
@ -48,11 +54,6 @@ public class UserAccountsDaoStub implements UserAccountsDao {
|
||||||
"UserAccountsDaoStub.getUserAccountByEmail() not implemented.");
|
"UserAccountsDaoStub.getUserAccountByEmail() not implemented.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isRootUser(UserAccount userAccount) {
|
|
||||||
throw new RuntimeException("UserAccountsDao.isRootUser() not implemented.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String insertUserAccount(UserAccount userAccount) {
|
public String insertUserAccount(UserAccount userAccount) {
|
||||||
throw new RuntimeException(
|
throw new RuntimeException(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue