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

  • SEARCH
  • Home
  • 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 6785111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:05:08+00:00 2026-05-26T17:05:08+00:00

I have some actions that requires a specific user permission to be accessed, so

  • 0

I have some actions that requires a specific user permission to be accessed, so I created a method annotation @RequiredPermission and a interceptor to verify if the method that is going to be executed have or not the annotation and if it have verify if the logged user have the permission.

The problem is that I don’t know how to get this information from ActionInvocation and neither from ActionContext.

I’m sure that should be one way to do it, cause if not I’d say its probably a not good framework to work with.

Any tip?

  • 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-05-26T17:05:09+00:00Added an answer on May 26, 2026 at 5:05 pm

    The information you need is contained in the ActionProxy, available via ActionInvocation.getProxy().

    Once you have the proxy, you have access to the action itself (from the ActionInvocation) and the method name (ActionProxy.getMethod()) as a string.

    From then on out it’s normal Java reflection.

    Method method = action.getClass().getDeclaredMethod(actionmethod);
    RequiredPermission permission = method.getAnnotation(RequiredPermission.class);
    if (sessionUser.inRoles(permission.getRoles()) {
        return invocation.invoke();
    }
    
    return Constants.LOGIN_REQUIRED_RESULT;
    

    Or however you want to handle the actual logic.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Action that requires authentication. The action method creates some records with
I have a class that I need to perform some actions on but I
I have an action method that depending on some conditions needs to return a
I have a div that the client will be doing some actions that (with
I have a WinForms application that requires some configuration which I do at install
I have a spring action that I am rendering some json from the controller,
I have some not understanding actions from gnu clisp Suppose, I have some code
I have an issue with System.Threading.Timer. I am scheduling some actions using a time
I am working on a game that requires resolution actions depending on the object
I have some content files that I would like to share between a number

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.