SecurityStrategy.AssociationPermissionsMode Property
Specifies the mode of processing security permissions for associations.
Namespace: DevExpress.ExpressApp.Security
Assembly: DevExpress.ExpressApp.Security.v26.1.dll
NuGet Package: DevExpress.ExpressApp.Security
Declaration
[DefaultValue(AssociationPermissionsMode.Auto)]
public AssociationPermissionsMode AssociationPermissionsMode { get; set; }
Property Value
| Type | Default | Description |
|---|---|---|
| AssociationPermissionsMode | Auto | An AssociationPermissionsMode value. |
Remarks
Add the following code to the Startup.cs file:
builder.Security
.UseIntegratedMode(options => {
options.RoleType = typeof(PermissionPolicyRole);
options.UserType = typeof(YourSolutionName.Module.BusinessObjects.ApplicationUser);
options.UserLoginInfoType = typeof(YourSolutionName.Module.BusinessObjects.ApplicationUserLoginInfo);
//...
options.Events.OnSecurityStrategyCreated += (securityStrategy) => {
//...
((SecurityStrategy)securityStrategy).AssociationPermissionsMode = AssociationPermissionsMode.Manual;
})
Refer to the Permissions for Associated Objects for more information about the available modes.
Important
In applications that support multiple authentication schemes, if the SecurityStrategy.AssociationPermissionsMode setting is set to Manual, you need to grant user access to their ApplicationUserLoginInfo object for authentication to work correctly. The code sample below demonstrates how to do this:
File: MySolution.Module\DatabaseUpdate\Updater.cs
private PermissionPolicyRole CreateDefaultRole() {
PermissionPolicyRole defaultRole = ObjectSpace.FirstOrDefault<PermissionPolicyRole>(role => role.Name == "Default");
if(defaultRole == null) {
defaultRole.AddObjectPermissionFromLambda<ApplicationUserLoginInfo>(
SecurityOperations.Read,
li => li.User.Oid == (Guid)CurrentUserIdOperator.CurrentUserId(),
SecurityPermissionState.Allow
);
// ...
}
return defaultRole;
}