Security Permissions Caching
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.
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.
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的更多相关文章
- 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 ...
- dotnetnuke 调用第三方dll出错 System.Security.Permissions.SecurityPermission,型的权限已失败。
在dnn下调用第三方dll的微信sdk ,代码如下: WebClient wc = new WebClient(); wc.Encoding = encoding ?? Encoding.UTF8; ...
- java Permissions and Security Policy--官方文档
3 Permissions and Security Policy 3.1 The Permission Classes The permission classes represent access ...
- [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 ...
- Page Security
参见开发文档 Overview This document describes how to build applications that grant selected access to indi ...
- Application Designer Security
This wiki page covers how to manage and restrict Application Designer security through permission li ...
- (C#)为应用程式设定运行权限(System.Security类下的GenericIdentity,GenericPrincipal,PrincipalPermission)
最近看书<编写高质量代码改善C#程序的157个建议>,知识点备忘: System.Security.Principal.GenericIdentity==>表示一般用户 System ...
- Android API Guides –System Permissions
系统权限 声明: 本文由Gordon翻译 公布于www.dlvoice.com 欢迎转载,但请保留此声明 原文地址:http://developer.android.com/guide/topics/ ...
- File and Folder Permissions
https://msdn.microsoft.com/en-us/library/bb727008.aspx On NTFS volumes, you can set security permiss ...
随机推荐
- 全部读取------------ 一次性全部读取的.read() VS 一行一行的for迭代
全部读取 f = open("喜洋洋",mode= "r",encoding= "utf-8") 方法一: 一次性全部读取f = o ...
- SDN 第一次上机作业
第一题 拓扑: 测试连通性: 第二题 拓扑: 测试连通性: 第三题 拓扑: 测试连通性:
- ubuntu 14.04 安装 openvswitch
安装 openvswitch (这里以openvswitch lib 分支为例) 如果没有安装git,如果有请跳过 $ sudo apt-get install git install ovs $ g ...
- Mina使用总结(四)传输对象ObjectSerializationCodecFactory
用mina框架传输对象,对于开发者来说,直接传输对象,而不用自己编写相应的报文转换代码,将大大节省 开发时间. 即使用对象编码解码器 使用ObjectSerializationCodecFactory ...
- Charles应用指南--安装与代理篇
Charles是开发测试过程中十分常用的一款代理软件,之前也写了一点基本使用.最近有新同事入职头一次用这个,就写了这么一份基本的安装和配置笔记. Charles 下载地址 mac:链接: https: ...
- rabbitmq的万能安装和外网访问(NC版)
先去这个http://www.rabbitmq.com/releases/下载erlang环境和rpm(erlang的尽量高点,rabbitmq版本差不多就可以了,) erlang-19.0.4-1. ...
- 1015. [JSOI2008]星球大战【并查集】
Description 很久以前,在一个遥远的星系,一个黑暗的帝国靠着它的超级武器统治者整个星系.某一天,凭着一个偶然的 机遇,一支反抗军摧毁了帝国的超级武器,并攻下了星系中几乎所有的星球.这些星球通 ...
- Asp.net MVC 控制器扩展方法实现jsonp
项目需要,在使用KendoUI,又涉及到jsonp数据格式的处理,网上看到这样一种实现方法,在此小记一下(其实是因为公司里只能上博客园等少数网站,怕自己忘了,好查看一下,哈哈哈) 1. 新建控制器扩展 ...
- jenkins webhook 配置
1. 安装插件 系统管理"->"插件管理"->"可选插件",选择Gitlab Hook Plugin GitLab Plugin,Gitl ...
- ES6新特性5:类(Class)和继承(Extends)
本文摘自ECMAScript6入门,转载请注明出处. 一.类(Class) 1.基本语法 JavaScript语言的传统方法是通过构造函数,定义并生成新对象.下面是一个例子 function Poin ...