[ 
https://issues.apache.org/jira/browse/SHIRO-657?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16735927#comment-16735927
 ] 

Brian Demers commented on SHIRO-657:
------------------------------------

(thinking out loud) a new annotation for a description might be a better bet, 
that way we are not mixing concerns.

In the example above it is pretty easy to follow:
{code:java}
@RequiresPermissions(value="admin:list", desc="Admin List Permission")
@GetMapping("/list")
{code}

But it gets tricker with wildcards:

{code:java}
@RequiresPermissions(value="admin:*:*:list", desc="A narrow subset of Admin 
List Permission")
@GetMapping("/list")
{code}

For non-wildcard permissions, you could probably use the permission string as a 
ResourceBundle key.

Can you explain your use case a bit more?


> Add desc to RequiresPermissions
> -------------------------------
>
>                 Key: SHIRO-657
>                 URL: https://issues.apache.org/jira/browse/SHIRO-657
>             Project: Shiro
>          Issue Type: Improvement
>            Reporter: Junling Bu
>            Priority: Minor
>
> This is a feature request.
> The use case is that I can parse RequiresPermissions to generate system 
> permission list.
> However, I want to generate description text for each defined permission 
> meanwhile. 
> These texts will give better user experience rather than actual permissions.
> For example:
> {code:java}
> @RequiresPermissions(value="admin:list", desc="Admin List Permission")
> @GetMapping("/list")
> public Object list(){
> }
> {code}
> Afterwards, I can generate following json array and only show label property 
> for users.
> {code:json}
> [
>   {
>     id: "admin:list",
>     label: "Admin List Permission"
>   }
> ...
> ]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to