Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with Grails Spring Security UI Plugin when creating new user - Error Processing GroovyPageView #56

Closed
mickdavis opened this issue Aug 23, 2016 · 8 comments
Assignees

Comments

@mickdavis
Copy link

I'm getting the following error using the Spring Security UI Plugin when I click on the link to create a new user:

"Error processing GroovyPageView: Error executing tag <s2ui:form>: Error executing tag <s2ui:tabs>: Error executing tag <s2ui:tab>: Error executing tag <s2ui:textFieldRow>: assert beanType | null"

I'm running Grails 2.5.5 with SpringSecurityCore 2.0.0 and SpringSecurityUI 1.0-RC3. I have not customized anything about the plugins.

Everything was working fine for several days. I'm able to create Roles, I can search for and edit Users. Everything except the ability to create a new User. I've spent over 8 hours trying to debug this.

Here's the trace:

`Line | Method
->> 528 | doFilter in /home/mdavis/development/grails/maintenanceManager/target/work/plugins/spring-security-ui-1.0-RC3/grails-app/views/user/create.gsp


Caused by GrailsTagException: Error executing tag s2ui:form: Error executing tag s2ui:tabs: Error executing tag s2ui:tab: Error executing tag s2ui:textFieldRow: assert beanType
|
null
->> 35 | doCall in /home/mdavis/development/grails/maintenanceManager/target/work/plugins/spring-security-ui-1.0-RC3/grails-app/views/user/create.gsp


Caused by GrailsTagException: Error executing tag s2ui:tabs: Error executing tag s2ui:tab: Error executing tag s2ui:textFieldRow: assert beanType
|
null
->> 31 | doCall in /home/mdavis/development/grails/maintenanceManager/target/work/plugins/spring-security-ui-1.0-RC3/grails-app/views/user/create.gsp


Caused by GrailsTagException: Error executing tag s2ui:tab: Error executing tag s2ui:textFieldRow: assert beanType
|
null
->> 21 | doCall in /home/mdavis/development/grails/maintenanceManager/target/work/plugins/spring-security-ui-1.0-RC3/grails-app/views/user/create.gsp


Caused by GrailsTagException: Error executing tag s2ui:textFieldRow: assert beanType
|
null
->> 13 | doCall in /home/mdavis/development/grails/maintenanceManager/target/work/plugins/spring-security-ui-1.0-RC3/grails-app/views/user/create.gsp


Caused by PowerAssertionError: assert beanType
|
null
->> 817 | labelCode in SecurityUiTagLib.groovy`

Any help would be greatly appreciated. Sorry in advance if this is hard to read, I've never posted anything here before.

Thanks in advance.

Mick

@marvinthepa
Copy link

By major coincidence, I ran into the exact same issue with the exact same versions of grails and the two plugins today. @mickdavis: I feel your pain.

@marvinthepa
Copy link

I think I found the issue. Spring-security-ui does not like it when the "Person" and "Role" domain objects (see http://grails-plugins.github.io/grails-spring-security-core/v2/guide/domainClasses.html#personClass) return null in their "toString" methods.

So my solution was to change

    String toString() {
        return this.username
    }

to

    String toString() {
        return this.username ?: 'Person without username'
    }

(this is for the Person class, but I had to update the Role class accordingly).

@marvinthepa
Copy link

Btw. I think the issue is still a bug in spring-security-ui, I will probably create a pull request soon.

marvinthepa pushed a commit to marvinthepa/grails-spring-security-ui that referenced this issue Aug 23, 2016
fixes grails#56, grails#51

Otherwise the bean will be cast to string in `labelCode`,
which will throw an assertion error if the bean returns null
in its "toString" method.

Also, I cannot see why somebody would want to use the `toString`
of e.g. a user object to look up the localization of the label
of that field. That just does not make sense.

user.username.label resp. role.authority.label is way more intuitive..
@mgkimsal
Copy link

mgkimsal commented Feb 4, 2017

@marvinthepa - your patch - can't get it working.

Can't get an override - I'll need to rebuild the entire plugin and use that one from a local repo vs just being able to override it somehow?

Was also trying to get my subclassed usercontroller to work in a namespace, but if the namespace is different from the parent class, that seems like it won't work either... (or would it?)

(the toString() stuff didn't work for me, unfortunately)

Thanks for your potential patch :)

@marvinthepa
Copy link

@mgkimsal: I don't know if you can override taglibs. Building the plugin yourself from source will definitely work.

If fixing your toString in your person and role domain objects didn't help, I suspect you are experiencing a different problem. I might be able to tell if you share the stacktrace that you see.

@ddelponte ddelponte self-assigned this Oct 2, 2017
@ddelponte
Copy link
Collaborator

@mickdavis @marvinthepa
I have been unable to reproduce this issue with:

compile "org.grails.plugins:spring-security-core:2.0.0"
compile "org.grails.plugins:spring-security-ui:1.0-RC3"

using grails-2.5.6 and java 8u144-zulu

Here's a link to a video demonstrating it working:
https://goo.gl/jCpiQS

and here's the test app I created:
security-ui_issue-56.zip

Are you able to provide a test app which reproduces the issue?

Thanks!

@marvinthepa
Copy link

marvinthepa commented Oct 10, 2017

@ddelponte:

to reproduce this with your example, you have to add a toString method that may return null, as mentioned in #56 (comment):

diff --git a/grails-app/domain/com/testapp/User.groovy b/grails-app/domain/com/testapp/User.groovy
index aacd5d0..235d48c 100644
--- a/grails-app/domain/com/testapp/User.groovy
+++ b/grails-app/domain/com/testapp/User.groovy
@@ -52,4 +52,9 @@ class User implements Serializable {
    static mapping = {
        password column: '`password`'
    }
+
+   @Override
+   public String toString() {
+       return username
+   }
 }

ddelponte added a commit that referenced this issue Oct 10, 2017
…new user - Error Processing GroovyPageView

Modified `form` tag so that
• `pageScope.s2uiBeanType` consistently set to the bean name
sdelamo pushed a commit that referenced this issue Oct 19, 2017
…new user - Error Processing GroovyPageView

Modified `form` tag so that
• `pageScope.s2uiBeanType` consistently set to the bean name
@sdelamo sdelamo closed this as completed Oct 19, 2017
@sdelamo
Copy link
Contributor

sdelamo commented Oct 19, 2017

Thanks @ddelponte for fixing this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants