Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8932633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:21:26+00:00 2026-06-15T09:21:26+00:00

my question is: It there any way that in renderEditor.template know what user is

  • 0

my question is: It there any way that in renderEditor.template know what user is logged in and what roles does he have?
What I want to do: In my app i want some field change when logged user is admin (“ROLE_ADMIN”) – normal user will have is html select tag only 1 option, by default selected, and when admin user will be logged in, list of all users appear.

I’m using Spring Security Plugin + Grails 2.1.1.

What I have already tried:

  1. Add Spring Security Service (def springSecurityService) but it was always null
  2. Try to pass boolean argument – no effect

Any help will be appreciated!

EDIT Many thanks for your answers. However, my question wasn’t precised enough, so I include some pseudocode that maybe explain better what I want achieve (method from renderTemplate.template)

private renderManyToOne(domainClass,property) {
        if (property.association) {
            def sb = new StringBuilder()
            sb << '<g:select'
            ...
            if (/*loged user is admin*/) {
                sb << ' from="${' << property.type.name << '.list()}"'
            }else{
                sb << ' from="${user}"'/*only loged user can be selected*/
            }
            ...
            sb << '/>'
            sb as String
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:21:27+00:00Added an answer on June 15, 2026 at 9:21 am

    There’s a taglib with spring security
    http://grails-plugins.github.com/grails-spring-security-core/docs/manual/guide/6%20Helper%20Classes.html#6.1%20SecurityTagLib

    In my app I use it like this:

    <ul>
    <sec:access expression="hasRole('ROLE_ADMIN')">
        <li><a href="#newFeedModal" role="button">Add New Feed</a></li>
    </sec:access>
    </ul>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a map with about 100,000 pairs . Is there any way that
JBoss 7.1.1.Final question: Is there any way that jboss.bind.address.management and jboss.bind.address.unsecure can be set
there's a question: Is there any way to pair Bluetooth device in Windows programmatically?
Simple question here: is there any way to convert from a jagged array to
My question is very simple: is there any way to (programmatically, technically, or manually)
My question is, Is there any way or is it possible to call Android
Sorry for this silly question, but is there any way to restrict using directives
Weird question, but i need to find an answer. Is there any way, in
Simple question really, is there any programmatic way to over load the choose a
Just a curious question but is there any programs that can help/aid you when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.