• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Permission类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中be.objectify.deadbolt.core.models.Permission的典型用法代码示例。如果您正苦于以下问题:Java Permission类的具体用法?Java Permission怎么用?Java Permission使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Permission类属于be.objectify.deadbolt.core.models包,在下文中一共展示了Permission类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: checkPermission

import be.objectify.deadbolt.core.models.Permission; //导入依赖的package包/类
@Override
public Promise<Boolean> checkPermission(String permissionValue, DeadboltHandler deadboltHandler, Context ctx) {
    boolean permissionOk = false;

    try {
        IUserAccount userAccount = getSecurityService().getCurrentUser();
        if (userAccount != null) {
            List<? extends Permission> permissions = userAccount.getPermissions();
            for (Iterator<? extends Permission> iterator = permissions.iterator(); !permissionOk && iterator.hasNext();) {
                Permission permission = iterator.next();
                permissionOk = permission.getValue().contains(permissionValue);
            }
        }
    } catch (Exception e) {
        log.error("impossible to get the user", e);
    }

    final boolean permissionOkFinal = permissionOk;
    return Promise.promise(() -> permissionOkFinal);
}
 
开发者ID:theAgileFactory,项目名称:app-framework,代码行数:21,代码来源:AbstractSecurityServiceImpl.java


示例2: checkPermission

import be.objectify.deadbolt.core.models.Permission; //导入依赖的package包/类
public boolean checkPermission(final String permissionValue,
                               final DeadboltHandler deadboltHandler,
                               final Http.Context ctx)
{
    return deadboltHandler.getSubject(ctx)
                          .map(new F.Function<Subject, Boolean>()
                          {
                              @Override
                              public Boolean apply(Subject subject) throws Throwable
                              {
                                  boolean permissionOk = false;

                                  if (subject != null)
                                  {
                                      List<? extends Permission> permissions = subject.getPermissions();
                                      for (Iterator<? extends Permission> iterator = permissions.iterator(); !permissionOk && iterator.hasNext(); )
                                      {
                                          Permission permission = iterator.next();
                                          permissionOk = permission.getValue().contains(permissionValue);
                                      }
                                  }

                                  return permissionOk;
                              }
                          }).get(1, TimeUnit.SECONDS);
}
 
开发者ID:play2-maven-plugin,项目名称:play2-maven-test-projects,代码行数:27,代码来源:MyDynamicResourceHandler.java


示例3: checkPermission

import be.objectify.deadbolt.core.models.Permission; //导入依赖的package包/类
public F.Promise<Boolean> checkPermission(final String permissionValue,
                                          final DeadboltHandler deadboltHandler,
                                          final Http.Context ctx)
{
    return deadboltHandler.getSubject(ctx)
                          .map(subjectOption -> {
                              final boolean[] permissionOk = {false};
                              subjectOption.ifPresent(subject -> {
                                  List<? extends Permission> permissions = subject.getPermissions();
                                  for (Iterator<? extends Permission> iterator = permissions.iterator(); !permissionOk[0] && iterator.hasNext(); )
                                  {
                                      Permission permission = iterator.next();
                                      permissionOk[0] = permission.getValue().contains(permissionValue);
                                  }
                              });

                              return permissionOk[0];
                          });
}
 
开发者ID:play2-maven-plugin,项目名称:play2-maven-test-projects,代码行数:20,代码来源:MyDynamicResourceHandler.java


示例4: getSubject

import be.objectify.deadbolt.core.models.Permission; //导入依赖的package包/类
@Override
public Promise<Optional<Subject>> getSubject(final Http.Context context) {
       if (context.session().get("username") != null && !context.session().get("username").isEmpty()) {
           // return an anonymous user
           return Promise.pure(Optional.of(new Subject() {
               @Override
               public List<? extends Role> getRoles() {
                   return Collections.emptyList();
               }

               @Override
               public List<? extends Permission> getPermissions() {
                   return Collections.emptyList();
               }

               @Override
               public String getIdentifier() {
                   return context.session().get("username");
               }
           }));
       } else {
           return Promise.pure(Optional.empty());
       }
}
 
开发者ID:thunderbit,项目名称:thunderbit,代码行数:25,代码来源:MyDeadboltHandler.java


示例5: checkPermission

import be.objectify.deadbolt.core.models.Permission; //导入依赖的package包/类
@Override
public boolean checkPermission(String permissionValue,
		DeadboltHandler deadboltHandler, Context ctx) {
	
	boolean permissionOk = false;
       Subject subject = deadboltHandler.getSubject(ctx);
       
       if (subject != null)
       {
           List<? extends Permission> permissions = subject.getPermissions();
           for (Iterator<? extends Permission> iterator = permissions.iterator(); !permissionOk && iterator.hasNext(); )
           {
               Permission permission = iterator.next();
               permissionOk = permission.getValue().contains(permissionValue);
           }
       }
       
       return permissionOk;
}
 
开发者ID:stefanil,项目名称:play2-prototypen,代码行数:20,代码来源:TreaseDynamicResourceHandler.java


示例6: getPermissions

import be.objectify.deadbolt.core.models.Permission; //导入依赖的package包/类
/**
 * Delegating.
 */
@Override
public List<? extends Permission> getPermissions() {

	Set<UserPermission> result = new HashSet<UserPermission>();
	
	for(SecurityRole r : roles){
		for(UserPermission p : r.getPermissions()){
			result.add(p);
		}
	}
	
	return new ArrayList<UserPermission>(result);
}
 
开发者ID:stefanil,项目名称:play2-prototypen,代码行数:17,代码来源:PermissionDelegatingSubject.java


示例7: getPermissions

import be.objectify.deadbolt.core.models.Permission; //导入依赖的package包/类
@Override
public List<? extends Permission> getPermissions() {
    return this.permissions;
}
 
开发者ID:theAgileFactory,项目名称:app-framework,代码行数:5,代码来源:AbstractDefaultCommonUserAccount.java


示例8: getPermissions

import be.objectify.deadbolt.core.models.Permission; //导入依赖的package包/类
@Override
public List<? extends Permission> getPermissions()
{
    return permissions;
}
 
开发者ID:play2-maven-plugin,项目名称:play2-maven-test-projects,代码行数:6,代码来源:AuthorisedUser.java


示例9: getPermissions

import be.objectify.deadbolt.core.models.Permission; //导入依赖的package包/类
@Override
public List<? extends Permission> getPermissions() {
	return this.permissions;
}
 
开发者ID:LSIR,项目名称:gsn,代码行数:5,代码来源:User.java


示例10: getPermissions

import be.objectify.deadbolt.core.models.Permission; //导入依赖的package包/类
@Override
   public List<? extends Permission> getPermissions()
   {
return Arrays.asList();
   }
 
开发者ID:beligum,项目名称:com.beligum.core.play,代码行数:6,代码来源:User.java


示例11: getPermissions

import be.objectify.deadbolt.core.models.Permission; //导入依赖的package包/类
@Override
public List<? extends Permission> getPermissions() {
	return permissions;
}
 
开发者ID:stefanil,项目名称:play2-prototypen,代码行数:5,代码来源:User.java



注:本文中的be.objectify.deadbolt.core.models.Permission类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ParseMode类代码示例发布时间:2022-05-22
下一篇:
Java MathUtils类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap