XAF is a powerful business application framework for .NET developers allowing you to concentrate more on business rules without the many distractions and tedious tasks normally associated with the traditional Windows, Web and Mobile development.
Search This Blog
Friday, July 31, 2015
Refreshing UI according to the security permission changes done through the application or directly in the database
Starting with version 15.1.7, the DevExpress.ExpressApp.Security.Adapters.IsGrantedAdapter class provides the following overloads of the Enable method:
Enable(ISecurityAdapterProvider securityAdapterProvider) - here ReloadPermissionStrategy = NoCache is used by default
Enable(ISecurityAdapterProvider securityAdapterProvider, ReloadPermissionStrategy reloadPermissionStrategy) Enable(IEnumerable<ISecurityAdapterProvider> securityAdapterProviders) Enable(IEnumerable<ISecurityAdapterProvider> securityAdapterProviders, ReloadPermissionStrategy reloadPermissionStrategy) Here is an example:
Take special note that to use these features, you must reference the new DevExpress.ExpressApp.Security.EF and DevExpress.ExpressApp.Security.Xpo assemblies to your projects.
The ReloadPermissionStrategy enumeration has the following values: CacheOnFirstAccess - the latest security permissions are loaded from the database only once, on the logon, and are used until the log off or next logon event. Permission request behavior is the same as in the previous mode. This helps avoid extra queries to the database while keeping the correct evaluation of object access permissions. NoCache - the latest security permissions are loaded from the database for each new XPO Session or EF DbContext. Based on this info, permission request results are calculated and cached. Subsequent permission requests are evaluated using the cache if the XPO Session or EF DbContext object was not changed.
By default, we provide several built-in implementations of the ISecurityAdapterProvider object, which you can use depending on the used security configuration: