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 ...
随机推荐
- Linux 环境部署记录(一) - 基础设定
时间设置 查看系统当前日期/时间: date -R 查看系统硬件时钟: hwclock --show 设置硬件时间: hwclock --set --date="07/18/17 20:55 ...
- Spring 源代码阅读之声明式事务
事务控制流程 例如对如下代码进行事务控制 class service1{ method1(){ method2(); } } class service2{ method2(); } 原理:建立一个m ...
- windows10 激活方法
1.“以管理员身份”运行 依次输出以下命令: slmgr.vbs /upk 2. 接着输入以下命令: slmgr /ipk W269N-WFGWX-YVC9B-4J6C9-T83GX 3. 继续输入以 ...
- 基于easyui开发Web版Activiti流程定制器详解(二)——文件列表
上一篇我们介绍了目录结构,这篇给大家整理一个文件列表以及详细说明,方便大家查找文件. 由于设计器文件主要保存在wf/designer和js/designer目录下,所以主要针对这两个目录进行详细说明. ...
- 1.4 Installation and Setup(安装和设置)
1.4 Installation and Setup(安装和设置) 这里我们用Anaconda发行版作为Python的使用环境,推荐安装Python3.6,本书就是用Python3.6代码写成的.(译 ...
- webbench安装和简单使用
一.安装流程 wget http://home.tiscali.cz/~cz210552/distfiles/webbench-1.5.tar.gz tar zxvf webbench-1.5.tar ...
- java 泛型数组列表
如下代码: package com.company; import java.lang.reflect.Array; import java.util.ArrayList; public class ...
- java ssm 后台框架平台 项目源码 websocket即时聊天发图片文字 好友群组 SSM源码
官网 http://www.fhadmin.org/D 集成安全权限框架shiro Shiro 是一个用 Java 语言实现的框架,通过一个简单易用的 API 提供身份验证和授权,更安全,更可靠E ...
- 如何编写编译Robocup3D代码
目录 开始编写球队代码 void NaoBehavior::beam() SkillType NaoBehavior::PlayOnSkill() 其他阶段函数 修复make异常 开始编写球队代码 装 ...
- PHP核心技术——面向对象
类与对象: 类的定义与实例化. //定义类 class person{ public $name; public $gender; public function say(){ echo $this- ...