Search This Blog

Friday, July 31, 2015

Refreshing UI according to the security permission changes done through the application or directly in the database

UPDATED:
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: 

[C#]
using DevExpress.ExpressApp.Security.Adapters; using DevExpress.ExpressApp.Security.Xpo.Adapters; IsGrantedAdapter.Enable(new XpoIntegratedCachedRequestSecurityAdapterProvider(), ReloadPermissionStrategy.CacheOnFirstAccess);

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:
    XpoUICachedRequestSecurityAdapterProvider - for Client-Side Security (XPO UI-level mode)
    XpoIntegratedCachedRequestSecurityAdapterProvider - for Client-Side Security (XPO integrated mode)
    XpoClientServerCachedRequestSecurityAdapterProvider - for Middle Tier Security (XPO)
    EFCachedRequestSecurityAdapterProvider - for Client-Side Security (Entity Framework UI-level mode) 

For older versions, please visit this Support Center thread.

No comments:

Post a Comment