dkellycollins
dkellycollins

Reputation: 497

Cannot verify if User is Admin in google apps

I am developing a google app that will only load if you are an administrator. Here is an example of what im trying to do.

public class MyAppEntryPoint implements EntryPoint {
    @Override
    public void onModuleLoad() {
         appUserServ = GWT.create(AppUserService.class);
         appUserServ.IsAdministrator(new AsyncCallback<Boolean>() {
        @Override
        public void onSuccess(Boolean isAdmin) {
            if(isAdmin) {
                LoadUI(); //Loads the site.
            }
        }
        @Override
        public void onFailure(Throwable caught) {
            //handle error
        }
    };
    }
}

AppUserService.IsAdministrator calls AppUser.IsAdministrator() which calls UserService.isUserAdmin().

When I try to run the app and log in as an administrator I get this error:

com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract boolean com.myapp.client.AsyncServices.AppUserService.IsAdministrator()' threw an unexpected exception: java.lang.VerifyError: Expecting a stackmap frame at branch target 38 in method com.myapp.UserService.AppUser.ValidUser()Z at offset 33
    ...
Caused by: java.lang.VerifyError: Expecting a stackmap frame at branch target 38 in method com.myapp.UserService.AppUser.ValidUser()Z at offset 33
    at com.myapp.server.AppUserServiceImpl.IsAdministrator(AppUserServiceImpl.java:26)
    ...

Does anyone know what this error means or how to fix it?

Also I am developing on v1.7 of google's SDK.

Upvotes: 0

Views: 203

Answers (1)

Dan Holevoet
Dan Holevoet

Reputation: 9183

When you say administrator, do you mean the Google App Engine concept of administrator? If so, you can configure this in app.yaml and reduce the complexity significantly. For example:

handlers:

- url: /admin/*
  servlet: com.example.AdminServlet
  login: admin

This example routes all requests to /admin/* to the AdminServlet and requires that the user be an administrator before displaying the page.

Upvotes: 2

Related Questions