Security Permissions Caching

Security permission caching is implemented in Security Adapters - classes used by the Security System to process and cache security permission requests. Each Security Adapter has the corresponding Security Adapter Provider class, which is used internally to register the adapter. XPO adapters and their providers are located in the DevExpress.ExpressApp.Security.Xpo.v17.1.dll assembly. The provider and adapter for the Entity Framework are available in the DevExpress.ExpressApp.Security.EF.v17.1.dll assembly. Both these assemblies (XPO and EF) contain the SecurityAdapterHelper class that exposes static methods that enable/disable Security Adapters. So, in your code, you do not need to access Security Adapters directly. This topic describes how to enable and customize caching using the SecurityAdapterHelper class.

Security Adapters中实现了权限系统缓存, 权限系统用于处理和缓存安全权限请求的类。每个安全适配器都有相应的安全适配器提供程序类, 它在内部用于注册适配器。适用于xpo的adapters在DevExpress. ExpressApp 安全. xpo. v17.1 .dll 程序集中。EF的Adapters在 DevExpress. ExpressApp. v17.1 .dll 程序集的安全。这些程序集 (xpo 和 ef) 都包含 SecurityAdapterHelper 类, 它公开了启用/禁用安全适配器的静态方法。因此, 在代码中, 不需要直接访问安全适配器。本主题介绍如何使用 SecurityAdapterHelper 类启用和自定义缓存。

 Enable Caching in Code

 

When creating a new XAF project, caching is enabled by the Solution Wizard. The wizard adds the following code line to the WinApplication.cs (WinApplication.vb) and WebApplication.cs (WebApplication.vb) files.

新建项目时,可以在创向导中选择这个选荐.也可以在代码中修改.(winapplication.cs/webapplication.cs)中:

using DevExpress.ExpressApp.Security;
// ...
SecurityAdapterHelper.Enable();

in the constructor of your platform-agnostic module located in the Module.cs (Module.vb) file;To enable or customize Security permissions caching in an existing application, use the same code, or use another overload of the Enable method that takes an ReloadPermissionStrategy enumeration value. You can call this static method from any place of your code, which is executed before a user is logged on, e.g.:

  • in the Main method of the WinForms application located in the Program.cs (Program.vb) file, before the WinApplication.Start call;
  • in the Application_Start method of the ASP.NET application located in the Global.asax.cs (Global.asax.vb) file, before the WebApplication.Start call.

The Solution Wizard uses the second and third locations.

若要在现有应用程序中启用或自定义安全权限缓存, 请使用相同的代码, 或使用采用 ReloadPermissionStrategy 枚举值的启用方法的另一个重载。您可以从代码的任何位置调用此静态方法 (在用户登录之前执行), 例如:
在您的平台不可知模块的构造器中, 位于 Module.cs (模块. vb) 文件中;
在 winforms 应用程序的 main 方法中, 位于 Program.cs (程序. vb) 文件中, 在 WinApplication 之前. 开始呼叫;
 

 Reload Permission Strategies

 

Security Adapters support various modes of reloading the security permissions. The available modes are listed in the ReloadPermissionStrategy enumeration. There is an overload of the SecurityAdapterHelper.Enable method that takes the reloadPermissionStrategy parameter - use it to change the mode. By default, the NoCache mode is used. Each Session (in XPO) or DBContext (in Entity Framework) operates with the most recent permissions loaded from the database in this mode. You can use the CacheOnFirstAccess mode instead. Permissions are loaded and cached when the corresponding secured data is accessed for the first time, cached permissions are used until the user is logged off in this mode. This mode allows you to significantly reduce the number of database requests when working with secured data.

安全适配器支持各种重新加载安全权限的模式。可用模式在 ReloadPermissionStrategy 枚举中列出。SecurityAdapterHelper 的重载. 启用采用 reloadPermissionStrategy 参数的方法-使用它来更改模式。默认情况下, 使用缓存模式。每个会话 (在 xpo 中) 或 DBContext (在实体框架中) 都使用此模式中从数据库加载的最新权限。您可以改用 CacheOnFirstAccess 模式。当第一次访问相应的安全数据时, 将加载和缓存权限, 直到用户在此模式下注销时才使用缓存的权限。此模式允许您在使用安全数据时显著减少数据库请求的数量。

Security Permissions Caching的更多相关文章

  1. CRM 2016 请求"System.Security.Permissions.FilelOPermission,mscorlib,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089"类型的权限已失败.

    CRM 请求"System.Security.Permissions.FilelOPermission,mscorlib,Version=4.0.0.0,Culture=neutral,Pu ...

  2. dotnetnuke 调用第三方dll出错 System.Security.Permissions.SecurityPermission,型的权限已失败。

    在dnn下调用第三方dll的微信sdk ,代码如下: WebClient wc = new WebClient();  wc.Encoding = encoding ?? Encoding.UTF8; ...

  3. java Permissions and Security Policy--官方文档

    3 Permissions and Security Policy 3.1 The Permission Classes The permission classes represent access ...

  4. [XAF] How to use the Allow/Deny permissions policy in the existing project

    https://www.devexpress.com/Support/Center/Question/Details/T418166 Clear [C#] using DevExpress.Persi ...

  5. Page Security

    参见开发文档 Overview This document describes how to build applications that grant selected access to indi ...

  6. Application Designer Security

    This wiki page covers how to manage and restrict Application Designer security through permission li ...

  7. (C#)为应用程式设定运行权限(System.Security类下的GenericIdentity,GenericPrincipal,PrincipalPermission)

    最近看书<编写高质量代码改善C#程序的157个建议>,知识点备忘: System.Security.Principal.GenericIdentity==>表示一般用户 System ...

  8. Android API Guides –System Permissions

    系统权限 声明: 本文由Gordon翻译 公布于www.dlvoice.com 欢迎转载,但请保留此声明 原文地址:http://developer.android.com/guide/topics/ ...

  9. File and Folder Permissions

    https://msdn.microsoft.com/en-us/library/bb727008.aspx On NTFS volumes, you can set security permiss ...

随机推荐

  1. 处理过期的archivelog和rman备份

    当手工删除了归档日志以后,Rman备份会检测到日志缺失,从而无法进一步继续执行.所以此时需要手工执行crosscheck过程,之后Rman备份可以恢复正常.[执行顺序如下:手工删除archivelog ...

  2. November 10th 2016 Week 46th Thursday

    Live like you were dying, love because you do. 生如将逝,爱自本心. When faced with our darkest hour, hope is ...

  3. MapReduce实例&YARN框架

    MapReduce实例&YARN框架 一个wordcount程序 统计一个相当大的数据文件中,每个单词出现的个数. 一.分析map和reduce的工作 map: 切分单词 遍历单词数据输出 r ...

  4. Outliner大纲式笔记软件介绍

    简介 什么是Outliner An outliner (or outline processor) is a specialized type of word processor used to vi ...

  5. sql server 使用链接服务器连接Oracle,openquery查询数据

      对接问题描述:不知道正式库oracle数据库账户密码,对方愿意在对方的客户端上输入账号和密码,但不告诉我们 解决方案:使用一台sql server作为中间服务器,可以通过转存数据到sql serv ...

  6. hdu2824 The Euler function(欧拉函数个数)

    版权声明:本文为博主原创文章,未经博主同意不得转载. vasttian https://blog.csdn.net/u012860063/article/details/36426357 题目链接:h ...

  7. 1260. [CQOI2007]涂色【区间DP】

    Description 假设你有一条长度为5的木版,初始时没有涂过任何颜色.你希望把它的5个单位长度分别涂上红.绿.蓝.绿.红色,用一个长度为5的字符串表示这个目标:RGBGR. 每次你可以把一段连续 ...

  8. openstack常用的一些命令

    查看rabbitmq 队列 rabbitmqctl list_queues 复制代码 查看keystone的用户 keystone user-list 复制代码 查看keystone endpoint ...

  9. linq to sql 分页技术

    昨天在用LINQ写分页的时候碰到一个很奇怪的问题:翻页的时候,有的数据会莫名其妙地消失,查了半个多小时才发现问题所在,其实是一个很细节的地方. 数据表如下: LINQ分页的实现是: var artic ...

  10. 定义一个复数(z=x+iy)类Complex,包含: 两个属性:实部x和虚部y 默认构造函数 Complex(),设置x=0,y=0 构造函数:Complex(int i,int j) 显示复数的方法:showComp()将其显示为如: 5+8i或5-8i 的形式。 求两个复数的和的方法:(参数是两个复数类对象,返回值是复数类对象)public Complex addComp(Compl

    因标题框有限,题目未显示完整,以下再放一份: 定义一个复数(z=x+iy)类Complex,包含: 两个属性:实部x和虚部y 默认构造函数 Complex(),设置x=0,y=0 构造函数:Compl ...