当前位置: 首页>>代码示例>>Java>>正文


Java Permission.implies方法代码示例

本文整理汇总了Java中org.apache.shiro.authz.Permission.implies方法的典型用法代码示例。如果您正苦于以下问题:Java Permission.implies方法的具体用法?Java Permission.implies怎么用?Java Permission.implies使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.shiro.authz.Permission的用法示例。


在下文中一共展示了Permission.implies方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: authorize

import org.apache.shiro.authz.Permission; //导入方法依赖的package包/类
@Override
public boolean authorize(final Object principal, final ResourcePermission context) {
  if (principal == null)
    return false;

  User user = this.userNameToUser.get(principal.toString());
  if (user == null)
    return false; // this user is not authorized to do anything

  // check if the user has this permission defined in the context
  for (Role role : this.userNameToUser.get(user.name).roles) {
    for (Permission permitted : role.permissions) {
      if (permitted.implies(context)) {
        return true;
      }
    }
  }

  return false;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:21,代码来源:ExampleSecurityManager.java

示例2: getPermittedCommands

import org.apache.shiro.authz.Permission; //导入方法依赖的package包/类
public static List<TestCommand> getPermittedCommands(Permission permission) {
  List<TestCommand> result = new ArrayList<>();
  for (TestCommand testCommand : testCommands) {
    ResourcePermission cPerm = testCommand.getPermission();
    if (cPerm != null && permission.implies(cPerm)) {
      result.add(testCommand);
    }
  }
  return result;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:11,代码来源:TestCommand.java

示例3: getPermittedCommands

import org.apache.shiro.authz.Permission; //导入方法依赖的package包/类
public static List<MashTestCommand> getPermittedCommands(Permission permission) {
  List<MashTestCommand> result = new ArrayList<>();
  for (MashTestCommand mashCommand : mashCommands) {
    ResourcePermission cPerm = mashCommand.getPermission();
    if (cPerm != null && permission.implies(cPerm)) {
      result.add(mashCommand);
    }
  }
  return result;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:11,代码来源:MashTestCommand.java

示例4: isPermitted

import org.apache.shiro.authz.Permission; //导入方法依赖的package包/类
@Override
protected boolean isPermitted(Permission permission, AuthorizationInfo info) {
	if (info == null || info instanceof AdvancedAuthorizationInfo && !((AdvancedAuthorizationInfo)info).authorized(project)) {
		return false;
	}
       Collection<Permission> perms = getPermissions(info);
       //提供给GlobalPermission使用.如果included = true,说明之前已经有GlobalPermission匹配过permission,且没有permission权限
       boolean included = false;
       if (CollectionUtils.isNotEmpty(perms)) {
           for (Permission perm : perms) {
           	if (perm instanceof GlobalPermission) {
           		GlobalPermission gp = (GlobalPermission)perm;
           		//GlobalPermission包含permission
           		if (perm.implies(permission)) {
           			if (gp.isPermitted()) {
           				return true;
					} else {
						included = true;
					}
				}
			} else if (perm.implies(permission)) {
                   return true;
               }
           }
       }
       //如果是系统一次性加载所有权限的模式且系统中不包含此验证permission则返回true,意思就是此permission不受权限管控,直接放行
	return globalPermissionMode && !included;
}
 
开发者ID:easycodebox,项目名称:easycode,代码行数:29,代码来源:DefaultCasRealm.java


注:本文中的org.apache.shiro.authz.Permission.implies方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。