Class PermGrantHelper
-
- All Implemented Interfaces:
public class PermGrantHelperRoot permission is empty, so the unite result is followed by `. *`. `inherit` means the scopes separated by `.` is an implicit inheritance relationship. `grant` means binding authorization.- Since:
2021-03-07
trydofor
-
-
Constructor Summary
Constructors Constructor Description PermGrantHelper()
-
Method Summary
Modifier and Type Method Description static StringunitePermit(String scopes, String action)static Array<String>splitPermit(String permit)static booleancanInherit(String top, String sub)Whether the `top` include `sub` (sub inherit top, case-insensitive) `*` means all, Compare actions with the same name static booleancanInherit(String top, String sub, String spl)Whether the `top` include `sub` (sub inherit top, case-insensitive) `*` means all, Compare actions with the same name static Set<String>inheritPerm(String permCode, Map<Long, String> permAll)Get the inherited permission by code. static Set<String>inheritPerm(long permId, Map<Long, String> permAll)Get the inherited permission by id. static Set<String>grantRole(long roleId, Map<Long, String> roleAll, Map<Long, Set<Long>> roleGrant)Get authorized roles by id -
-
Method Detail
-
unitePermit
static String unitePermit(String scopes, String action)
-
splitPermit
static Array<String> splitPermit(String permit)
-
canInherit
static boolean canInherit(String top, String sub)
Whether the `top` include `sub` (sub inherit top, case-insensitive) `*` means all, Compare actions with the same name
- Parameters:
top- e.g.sub- e.g.
-
canInherit
static boolean canInherit(String top, String sub, String spl)
Whether the `top` include `sub` (sub inherit top, case-insensitive) `*` means all, Compare actions with the same name
- Parameters:
top- e.g.sub- e.g.spl- separator, default `.
-
inheritPerm
@NotNull() static Set<String> inheritPerm(String permCode, Map<Long, String> permAll)
Get the inherited permission by code. e.g. `system.menu` inherits from `system`
- Parameters:
permCode- top perm codepermAll- all perms id-code map- Returns:
inherited perms
-
inheritPerm
@NotNull() static Set<String> inheritPerm(long permId, Map<Long, String> permAll)
Get the inherited permission by id. e.g. `system.menu` inherits from `system`
- Parameters:
permId- top perm idpermAll- all perms id-code map- Returns:
inherited perms
-
-
-
-