Search in sources :

Example 11 with AuthConstraint

use of com.peterphi.std.guice.common.auth.annotations.AuthConstraint in project stdlib by petergeneric.

the class UserUIServiceImpl method getUsers.

@Override
@Transactional(readOnly = true)
@AuthConstraint(role = UserLogin.ROLE_ADMIN)
public String getUsers(UriInfo query) {
    ConstrainedResultSet<UserEntity> resultset = accountDao.findByUriQuery(new WebQuery().orderAsc("id").decode(query));
    TemplateCall call = templater.template("users");
    call.set("resultset", resultset);
    call.set("users", resultset.getList());
    call.set("nonce", nonceStore.getValue(NONCE_USE));
    return call.process();
}
Also used : WebQuery(com.peterphi.std.guice.restclient.jaxb.webquery.WebQuery) UserEntity(com.peterphi.usermanager.db.entity.UserEntity) TemplateCall(com.peterphi.std.guice.web.rest.templating.TemplateCall) AuthConstraint(com.peterphi.std.guice.common.auth.annotations.AuthConstraint) Transactional(com.peterphi.std.guice.database.annotation.Transactional)

Aggregations

AuthConstraint (com.peterphi.std.guice.common.auth.annotations.AuthConstraint)11 Transactional (com.peterphi.std.guice.database.annotation.Transactional)4 TemplateCall (com.peterphi.std.guice.web.rest.templating.TemplateCall)4 UserEntity (com.peterphi.usermanager.db.entity.UserEntity)4 AuthenticationFailureException (com.peterphi.usermanager.guice.authentication.AuthenticationFailureException)2 OAuth2TokenResponse (com.peterphi.usermanager.rest.iface.oauth2server.types.OAuth2TokenResponse)2 Response (javax.ws.rs.core.Response)2 AuthScope (com.peterphi.std.guice.common.auth.AuthScope)1 CurrentUser (com.peterphi.std.guice.common.auth.iface.CurrentUser)1 Retry (com.peterphi.std.guice.common.retry.annotation.Retry)1 WebQuery (com.peterphi.std.guice.restclient.jaxb.webquery.WebQuery)1 OAuth2SessionRef (com.peterphi.std.guice.web.rest.auth.oauth2.OAuth2SessionRef)1 OAuthServiceEntity (com.peterphi.usermanager.db.entity.OAuthServiceEntity)1 RoleEntity (com.peterphi.usermanager.db.entity.RoleEntity)1 SessionNonceStore (com.peterphi.usermanager.guice.nonce.SessionNonceStore)1 URI (java.net.URI)1 HttpSession (javax.servlet.http.HttpSession)1 NewCookie (javax.ws.rs.core.NewCookie)1