Search code examples
javaapachesecurityshiro

Shiro 'Any' Permission Instance


I'm confused about Shiro Permission Format. I have a permission called:

'messages:publish:anyThing'

A person has the permission:

'messages:publish:1(Category ID)'

I'm trying to give a permission to any people that have any instance of this permission:

'messages:publish'

I tried the follow line:

if (SecurityUtils.getPrincipal().isPermitted("messages:publish:?")) 

but without success.

I know that all is * , and how is 'Any'?


Solution

  • See this answer: https://stackoverflow.com/a/5281900/1279987

    So you can try this instead:

    if (SecurityUtils.getPrincipal().isPermitted("messages:publish:*"))