zoukankan      html  css  js  c++  java
  • 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.

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

    Expanded 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 之前. 开始呼叫;
     

    Expanded 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 模式。当第一次访问相应的安全数据时, 将加载和缓存权限, 直到用户在此模式下注销时才使用缓存的权限。此模式允许您在使用安全数据时显著减少数据库请求的数量。

  • 相关阅读:
    Linux中逻辑卷的快照与还原
    Linux 中磁盘阵列RAID10损坏以及修复
    Linux 中磁盘阵列RAID10配置
    Linux 中磁盘容量配额
    Centos7VMware虚拟机最小化安装后,安装Tenda U12 USB无线网卡驱动
    安装vmware-tools遇the path "" is not valid path to the gcc binary和the path "" is not a valid path to the 3.10.0-327.e17.x86_64 kernel headers问题解决
    /etc/postfix下 main.cf 配置文件详解
    Linux安装配置vsftp搭建FTP的详细配置
    Linux中ftp的常用命令
    javascript深入理解js闭包
  • 原文地址:https://www.cnblogs.com/foreachlife/p/7068281.html
Copyright © 2011-2022 走看看