Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

On this page all the generic security filters are listed, In general, they can be applied to all possible DB entities of the CoreOne Suite.

Table of Contents

Filter

General

GenericFullAccessFilter

This filter will give you unrestricted access to the entity for the chosen DB operation.

Code Block
languagec#
/// <typeparam name="TDtoType">The interface type of the db entity the full access should be applied to</typeparam>
GenericNoAccessFilter<TDtoType>

Example

Code Block
languagec#
new GenericNoAccessFilter<ICoreIdentity>()

...

This filter will give you no access to the entity for the chosen DB operation

Code Block
languagec#
/// <typeparam name="TDtoType">The interface type of the db entity the no access should be applied to</typeparam>
new GenericNoAccessFilter<TDtoType>();

Example

Code Block
languagec#
new GenericNoAccessFilter<ICoreIdentity>()

Sub Filters

...

SecurityFilterCollection

When you want to combine one or more filters together you can use the security filter collection.

For example, because I have read rights to the core identity, I’m allowed to read its attribute values.

GenericSubFiltersFilter

This filter will give access to the DB entity only when the filter for the referenced object matches the chosen security mode as well.

This filter can be used for up to four reference types, then all four security filters have to match in an and combination.

...

you want to build a security filter that allows you to read core identities of type Standard but only when the name starts with ‘Ma’, then you have to combine GenericPropertyChainFilter with a GenericPropertyChainStringFilter in a and relation. This you can do with a security filter collection.

Code Block
languagec#
/// <typeparam<param name="TDtoTypedtoType">The interface type of the db entity this security filter should be applied to</typeparam>param>
/// <typeparam<param name="TReferenceDtoTypecollectionMode">The>If interfacethe typefilter ofshould thebe dbcombined entitywith whereor theor security should be taken from</typeparam>and </param>
/// <param name="referenceSecurityModefilters">What>The security modefilter shouldyou bewant checkto for TReferenceDtoType<combine</param>
///static <param name="referenceProperty">How the system can resolve TReferenceDtoType from TDtoType</param>
GenericSubFiltersFilter<TDtoType, TReferenceDtoType>(SecurityMode referenceSecurityMode, Expression<Func<TDtoType, TReferenceDtoType>> referenceProperty)
GenericSubFiltersFilter<TDtoType, TReferenceDtoType1, TReferenceDtoType2>(SecurityMode referenceSecurityMode, Expression<Func<TDtoType, TReferenceDtoType1>> referenceProperty, SecurityMode referenceSecurityMode2, Expression<Func<TDtoType, TReferenceDtoType2>> referenceProperty2)
...
GenericSubFiltersFilter<TDtoType, TReferenceDtoType1, TReferenceDtoType2, TReferenceDtoType3, TReferenceDtoType4>(SecurityMode referenceSecurityMode1, Expression<Func<TDtoType, TReferenceDtoType1>> referenceProperty1, SecurityMode referenceSecurityMode2,Expression<Func<TDtoType, TReferenceDtoType2>> referenceProperty2, SecurityMode referenceSecurityMode3, Expression<Func<TDtoType, TReferenceDtoType3>> referenceProperty3, SecurityMode referenceSecurityMode4,Expression<Func<TDtoType, TReferenceDtoType3>> referenceProperty4)

Example

Code Block
new GenericSubFiltersFilter<IOrganizationUnitAttributeValue, IOrganizationUnit>(SecurityMode.Update, a => a.OrganizationUnit)

GenericCollectionSubFiltersFilter

This filter will give access to the DB entity only when the filter for the referenced object matches a least one item in the collection of referenced objects.

code
SecurityFilterCollection Create(Type dtoType, FilterCollectionMode collectionMode, ISecurityFilter[] filters)

Sub Filters

The sub-filters will give you access to an entity based on the configured security of a related entity.

For example, because I have read rights to the core identity, I’m allowed to read its attribute values.

GenericSubFiltersFilter

This filter will give access to the DB entity only when the filter for the referenced object matches the chosen security mode as well.

This filter can be used for up to four reference types, then all four security filters have to match in an and combination.

Code Block
languagec#
/// <typeparam name="TDtoType">The interface type of the db entity this security filter should be applied to</typeparam>
/// <typeparam name="TReferenceDtoType">The interface type of the db entity where the security should be taken from</typeparam>
/// <param name="referenceSecurityMode">What security mode should be check for TReferenceDtoType</param>
/// <param name="referenceProperty">How the system can resolve TReferenceDtoType from TDtoType</param>
GenericSubFiltersFilter<TDtoType, TReferenceDtoType>(SecurityMode referenceSecurityMode, Expression<Func<TDtoType, TReferenceDtoType>> referenceProperty)
GenericSubFiltersFilter<TDtoType, TReferenceDtoType1, TReferenceDtoType2>(SecurityMode referenceSecurityMode, Expression<Func<TDtoType, TReferenceDtoType1>> referenceProperty, SecurityMode referenceSecurityMode2, Expression<Func<TDtoType, TReferenceDtoType2>> referenceProperty2)
...
GenericSubFiltersFilter<TDtoType, TReferenceDtoType1, TReferenceDtoType2, TReferenceDtoType3, TReferenceDtoType4>(SecurityMode referenceSecurityMode1, Expression<Func<TDtoType, TReferenceDtoType1>> referenceProperty1, SecurityMode referenceSecurityMode2,Expression<Func<TDtoType, TReferenceDtoType2>> referenceProperty2, SecurityMode referenceSecurityMode3, Expression<Func<TDtoType, TReferenceDtoType3>> referenceProperty3, SecurityMode referenceSecurityMode4,Expression<Func<TDtoType, TReferenceDtoType3>> referenceProperty4)

Example

Code Block
languagec#
new GenericSubFiltersFilter<IOrganizationUnitAttributeValue, IOrganizationUnit>(SecurityMode.Update, a => a.OrganizationUnit)

GenericCollectionSubFiltersFilter

This filter will give access to the DB entity only when the filter for the referenced object matches a least one item in the collection of referenced objects.

Code Block
languagec#
/// <typeparam name="TDtoType">The interface type of the db entity this security filter should be applied to</typeparam>
/// <typeparam name="TReferenceCollectionDtoType1">The interface type of the db entity where the security should be taken from</typeparam>
/// <param name="referenceDtoTypeSecurityMode">What security mode should be check for TReferenceCollectionDtoType1</param>
/// <param name="referenceProperty">How the system can resolve TReferenceCollectionDtoType1 from TDtoType</param>
GenericCollectionSubFiltersFilter<TDtoType, TReferenceCollectionDtoType1>(SecurityMode referenceDtoTypeSecurityMode, Expression<Func<TDtoType, IEnumerable<TReferenceCollectionDtoType1>>> referenceProperty)

Example

Code Block
languagec#
new GenericCollectionSubFiltersFilter<IEventHandlerType, IEventHandler>(SecurityMode.Read, n => n.EventHandlers)

Property Chain Filter

The property chain filters give access to the DB entity when the resolved value of the property of the chain matches the one of the filter values.

GenericPropertyChainFilter

Code Block
languagec#
/// <typeparam name="TDtoTypeTDtoObject">The interface type of the db entity this security filter should be applied to</typeparam>
/// <typeparam name="TReferenceCollectionDtoType1TFilterPropertyType">The interface type of the db entity where the security should be taken from<filters</typeparam>
/// <param name="referenceDtoTypeSecurityMode">What security modepropertyChain">The path from the entity to the property that should be compared with checkthe forfilter TReferenceCollectionDtoType1<values</param>
/// <param name="referenceProperty">How the system can resolve TReferenceCollectionDtoType1 from TDtoType</param>
GenericCollectionSubFiltersFilter<TDtoType, TReferenceCollectionDtoType1>(SecurityMode referenceDtoTypeSecurityMode, Expression<Func<TDtoType, IEnumerable<TReferenceCollectionDtoType1>>> referenceProperty)

Example

Code Block
new GenericCollectionSubFiltersFilter<IEventHandlerType, IEventHandler>(SecurityMode.Read, n => n.EventHandlers)

Property Chain Filter

The property chain filters give access to the DB entity when the resolved value of the property of the chain matches the one of the filter values.

GenericPropertyChainFilter

code
filterValues">The filter values that have to match with the property value</param>
GenericPropertyChainFilter<TDtoObject, TFilterPropertyType>(Expression<Func<TDtoObject, TFilterPropertyType>> propertyChain, params TFilterPropertyType[] filterValues) 

Example

Code Block
languagec#
new GenericPropertyChainFilter<IActivityButton, bool>(m => m.AllowExecutionAsOwner, true)

GenericPropertyChainStringFilter

This filter allows us to check the security with a text filter with some search behaviors like contains or start with.

Code Block
languagec#
/// <typeparam name="TDtoObject">The interface type of the db entity this security filter should be applied to</typeparam>
/// <typeparam<param name="TFilterPropertyTypepropertyChain">The type of path from the entity to the property that should be compared with the filters<filter values</typeparam>param>
/// <param name="propertyChainstringFilterBehaviour">The pathbehaviour fromhow the entity to the property that shouldfilter will be comparedapplied withto the filter values<property</param>
/// <param name="filterValuesfilterValue">The filter values that have to match with the property string value</param>
GenericPropertyChainFilter<TDtoObject,GenericPropertyChainStringFilter<TDtoObject> TFilterPropertyType>(Expression<Func<TDtoObject, string>> propertyChain, StringFilterBehaviour stringFilterBehaviour, TFilterPropertyType>> propertyChain, params TFilterPropertyType[] filterValues) string filterValue)

Possible values for stringFilterBehaviour

Code Block
languagec#
Equals,
StartsWith,
EndsWith,
Contains

Example

Code Block
languagec#
new GenericPropertyChainFilter<IActivityButtonGenericPropertyChainStringFilter<ICoreIdentity, bool>(m => m.AllowExecutionAsOwner, true)

GenericPropertyChainStringFilter

This filter allows us to check the security with a text filter with some search behaviors like contains or start with.

Code Block
/// <typeparam name="TDtoObject">The interface type of the db entity this security filter should be applied to</typeparam>
/// <param name="propertyChain">The path from the entity to the property that should be compared with the filter values</param>
/// <param name="stringFilterBehaviour">The behaviour how the filter will be applied to the property</param>
/// <param name="filterValue">The filter string value</param>
GenericPropertyChainStringFilter<TDtoObject> (Expression<Func<TDtoObject, string>> propertyChain, StringFilterBehaviour stringFilterBehaviour, string filterValue)

Possible values for stringFilterBehaviour

Code Block
Equals,
StartsWith,
EndsWith,
Contains

Example

Code Block
new GenericPropertyChainStringFilter<ICoreIdentity, bool>(m => m.ReadOnlyDisplayName, StringFilterBehaviour.Contains,"Test")

GenericCollectionPropertyChainFilter

This filter allows checking a reference collection if one of these objects matches the filter value.

Code Block
ReadOnlyDisplayName, StringFilterBehaviour.Contains,"Test")

GenericCollectionPropertyChainFilter

This filter allows checking a reference collection if one of these objects matches the filter value.

Code Block
languagec#
/// <typeparam name="TDtoObject">The interface type of the db entity this security filter should be applied to</typeparam>
/// <typeparam name="TDtoCollectionObject">The interface type of the db entity of the related collection</typeparam>
/// <typeparam name="TDtoObjectTFilterPropertyType">The interface type of the db entity this security filter should be applied to<filters</typeparam>
/// <typeparam<param name="TDtoCollectionObjectpropertyChain">The path from interfacethe typeentity ofto the db entity of property that should be compared with the relatedfilter collection<values</typeparam>param>
/// <typeparam<param name="TFilterPropertyTypesubPropertyChain">The type path to the collection of thetype filters<TDtoCollectionObject</typeparam>param>
/// <param name="propertyChainfilterValues">The pathfilter fromvalues thethat entityhave to match with the property that should be compared with the filter values</param>
/// <param name="subPropertyChain">The path to the collection of type TDtoCollectionObject</param> value</param>
GenericCollectionPropertyChainFilter<TDtoObject, TDtoCollectionObject, TFilterPropertyType> (Expression<Func<TDtoObject, IEnumerable<TDtoCollectionObject>>> propertyChain, Expression<Func<TDtoCollectionObject, TFilterPropertyType>> subPropertyChain, params TFilterPropertyType[] filterValues)

My core identity filters

GenericMyCoreIdentityFilter / GenericMyCoreIdentityStringValueFilter

This filter gives you permission for the entity type only when your core identity id matches the value of the property chain.

Code Block
languagec#
/// <typeparam name="TDtoObject">The interface type of the db entity this security filter should be applied to</typeparam>
/// <param name="filterValuespropertyChain">The path to filterthe valuesproperty that have will be compared it to matchthe withcurrent thecore propertyidentity value<id</param>
GenericMyCoreIdentityFilter<TDtoObject> GenericCollectionPropertyChainFilter<TDtoObject(Expression<Func<TDtoObject, TDtoCollectionObject, TFilterPropertyType>uint>> propertyChain)
GenericMyCoreIdentityStringValueFilter<TDtoObject> (Expression<Func<TDtoObject, IEnumerable<TDtoCollectionObject>>>string>> propertyChain, Expression<Func<TDtoCollectionObject, TFilterPropertyType>> subPropertyChain, params TFilterPropertyType[] filterValues)

My core identity filters

...

) 

Example:

Code Block
languagec#
new GenericMyCoreIdentityFilter<IRoleAssignmentApproval>(i => i.CoreIdentity.Id))

GenericMyCoreIdentityCollectionFilter

This filter gives you permission for the entity type only when your core identity id matches the value of the property chain.

...

is present in a related collection.

Code Block
languagec#
/// <typeparam name="TDtoObject">The interface type of the db entity this security filter should be applied to</typeparam>
/// <typeparam name="TDtoObjectTDtoCollectionObject">The interface type of the db entity this security filter should be applied to</typeparam> of the related collection</typeparam>
/// <param name="propertyChain">The path from the TDtoObject to the collection of TDtoCollectionObject</param>
/// <param name="propertyChainsubPropertyChain">The path to the property that will be compared it to the current core identity id</param>
GenericMyCoreIdentityFilter<TDtoObject>GenericMyCoreIdentityCollectionFilter<TDtoObject, TDtoCollectionObject> (Expression<Func<TDtoObject, uint>>IEnumerable<TDtoCollectionObject>>> propertyChain)
GenericMyCoreIdentityStringValueFilter<TDtoObject> (Expression<Func<TDtoObject, Expression<Func<TDtoCollectionObject, string>>uint>> propertyChain) subPropertyChain

Example:

Code Block
languagec#
new GenericMyCoreIdentityFilter<IRoleAssignmentApproval>(iGenericMyCoreIdentityCollectionFilter<ICoreIdentityTypeAttributeMapping, ICoreIdentity>(ct => i.CoreIdentityct.CoreIdentityType.CoreIdentities, c => c.Id))

...

My user filters

GenericMyUserValueFilter/ GenericMyUserStringValueFilter

This filter gives you permission for the entity type only when your core identity id is present in a related collection.

...

languagec#

...

user id matches the value of the property chain.

Code Block
languagec#
/// <typeparam name="TDtoCollectionObjectTDtoObject">The interface type of the db entity ofthis thesecurity relatedfilter collection</typeparam>
/// <param name="propertyChain">The path from the TDtoObject to the collection of TDtoCollectionObject</param>should be applied to</typeparam>
/// <param name="subPropertyChainpropertyChain">The path to the property that will be compared it to the current core identityuser id</param>
GenericMyCoreIdentityCollectionFilter<TDtoObject,GenericMyUserValueFilter<TDtoObject> TDtoCollectionObject> (Expression<Func<TDtoObject, IEnumerable<TDtoCollectionObject>>>uint>> propertyChain, Expression<Func<TDtoCollectionObject)
GenericMyCoreIdentityStringValueFilter<TDtoObject> (Expression<Func<TDtoObject, uint>>string>> subPropertyChainpropertyChain)

Example:

Code Block
languagec#
new GenericMyCoreIdentityCollectionFilter<ICoreIdentityTypeAttributeMapping, ICoreIdentity>(ctGenericMyUserValueFilter<IUser>(u => ct.CoreIdentityType.CoreIdentities, c => cu.Id)

My user filters

...

GenericMyUserCollectionFilter

This filter gives you permission for the entity type only when your user id matches the value of the property chainis present in a related collection.

Code Block
languagec#
/// <typeparam name="TDtoObject">The interface type of the db entity this security filter should be applied to</typeparam>
/// <typeparam name="TDtoObjectTDtoCollectionObject">The interface type of the db entity this security filter should be applied to</typeparam> of the related collection</typeparam>
/// <param name="propertyChain">The path from the TDtoObject to the collection of TDtoCollectionObject</param>
/// <param name="propertyChainsubPropertyChain">The path to the property that will be compared it to the current user id</param>
GenericMyUserCollectionFilter<TDtoObject, GenericMyUserValueFilter<TDtoObject>TDtoCollectionObject> (Expression<Func<TDtoObject, uint>>IEnumerable<TDtoCollectionObject>>> propertyChain)
GenericMyCoreIdentityStringValueFilter<TDtoObject> (Expression<Func<TDtoObject, Expression<Func<TDtoCollectionObject, string>>uint>> propertyChainsubPropertyChain)

Example:

Code Block
languagec#
new GenericMyUserValueFilter<IUser>(GenericMyUserCollectionFilter<IRoleClaim, IUser>(r => r.Users, u => u.Id)

...

Context filter

This filter gives you permission for the entity type only when your user id is present in a related collection.

...

The context filter allows structuring the security based on the context this filter was assigned with.

For example, based on the organization unit tree I get a security role assigned in the context of the current organization and this should allow me to read this one organization unit.

For the definition of what context should be compared to what property value the class ContextPropertyFilterDefintion is used.

Code Block
languagec#
/// <typeparam name="TDtoCollectionObjectTDtoObject">The interface type of the db entity ofyou thewant relatedto collection<filter</typeparam>
/// <param name="propertyChain">The path to the fromproperty theyou TDtoObjectwant to thecompare collectionwith ofthe TDtoCollectionObject<context</param>
/// <param name="subPropertyChaincontextType">The pathcontext totype theyou property that will be compared it want to theuse currentas user id<filter</param>
GenericMyUserCollectionFilter<TDtoObject,ContextPropertyFilterDefintion<TDtoObject> TDtoCollectionObject> (Expression<Func<TDtoObject, IEnumerable<TDtoCollectionObject>>>uint>> propertyChain, Expression<Func<TDtoCollectionObject, uint>> subPropertyChainCoreLoginAssignmentContextTypes contextType)

Example:

Code Block
languagec#
new GenericMyUserCollectionFilter<IRoleClaim, IUser>(rContextPropertyFilterDefintion<IEventHandler>(e => r.Users, u => u.Id)

Context filter

...

e.EventHandlerType.Id, CoreLoginAssignmentContextTypes.OrganizationUnit),

This example compares the value of the EventHandlerType.Id from IEventHandler to the context identifier of the type organization unit.

Possible context types:

Code Block
languagec#
OrganizationUnit,
User

GenericContextPropertyChainFilter

This security filter gives you access to an entity when all property filters match the context this security filter was assigned with.

For example, based on the organization unit tree I get a security role assigned in the context of the current organization and this should allow me to read this one organization unit.

For the definition of what context should be compared to what property value the class ContextPropertyFilterDefintion is used.

Code Block
/// <typeparam name="TDtoObject">The type of the entity you want to filter</typeparam>
/// <param name="propertyChain">The path to the property you want to compare with the context</param>
/// <param name="contextType">The context type you want to use as filter</param>
ContextPropertyFilterDefintion<TDtoObject> (Expression<Func<TDtoObject, uint>> propertyChain, CoreLoginAssignmentContextTypes contextType)

Example:

Code Block
new ContextPropertyFilterDefintion<IEventHandler>(e => e.EventHandlerType.Id, CoreLoginAssignmentContextTypes.OrganizationUnit),

This example compares the value of the EventHandlerType.Id from IEventHandler to the context identifier of the type organization unit.

Possible context types:

Code Block
OrganizationUnit,
User

GenericContextPropertyChainFilter

This security filter gives you access to an entity when all property filters match the context this security filter was assigned with.

...

Code Block
languagec#
/// <typeparam name="TDtoObject">The interface type of the db entity this security filter should be applied to</typeparam>
/// <param name="filter">The definition off what you want to filter</param>
GenericContextPropertyChainFilter<TDtoObject> (ContextPropertyFilter<TDtoObject> filter)

Example:

Code Block
languagec#
new GenericContextPropertyChainFilter<IEventHandler>(new ContextPropertyFilter<IEventHandler>(new[]
{
    new ContextPropertyFilterDefintion<IEventHandler>(e => e.EventHandlerType.Id, CoreLoginAssignmentContextTypes.OrganizationUnit),
    new ContextPropertyFilterDefintion<IEventHandler>(e => e.Id, CoreLoginAssignmentContextTypes.User)
}));

GenericContextCollectionPropertyChainFilter

This security filter works similarly to the GenericContextPropertyChainFilter, with the difference that not the entity itself has to match the property filter, but the filter will be applied with an any to a related collection of entities.

Code Block
languagec#
/// <typeparam name="TDtoObject">The interface type of the db entity this security filter should be applied to</typeparam>
/// <typeparam name="TDtoCollectionObject">The interface type of the db entity of the related collection</typeparam>
/// <param name="propertyChain">The path from the TDtoObject to the collection of TDtoCollectionObject</param>
/// <param name="filter">The definition off what you want to filter</param>
GenericContextCollectionPropertyChainFilter<TDtoObject, GenericContextPropertyChainFilter<TDtoObject>TDtoCollectionObject> (ContextPropertyFilter<TDtoObject>Expression<Func<TDtoObject, IEnumerable<TDtoCollectionObject>>> propertyChain, ContextPropertyFilter<TDtoCollectionObject> filter)

Example:

...

Code Block
languagec#
new GenericContextCollectionPropertyChainFilter<IEventHandler, GenericContextPropertyChainFilter<IEventHandler>(IEventSubscription>(e => e.EventSubscriptions, new ContextPropertyFilter<IEventHandler>ContextPropertyFilter<IEventSubscription>(new[]
{
    new ContextPropertyFilterDefintion<IEventHandler>ContextPropertyFilterDefintion<IEventSubscription>(e => e.EventHandlerTypeEventHandler.Id, CoreLoginAssignmentContextTypes.OrganizationUnit),
    new ContextPropertyFilterDefintion<IEventHandler>ContextPropertyFilterDefintion<IEventSubscription>(e => e.Id, CoreLoginAssignmentContextTypes.User)
}));

GenericContextCollectionPropertyChainFilter

This security filter works similarly to the GenericContextPropertyChainFilter, with the difference that not the entity itself has to match the property filter, but the filter will be applied with an any to a related collection of entities.

...

Assignment

GenericMyValidAssignmentFilter (Version >= 8)

This filter will give you access to the entity only if you have a valid assignment.

Code Block
languagec#
/// <typeparam name="TDtoObjectTDtoType">The interface type of the db entity this security filter should be applied to</typeparam>
/// <typeparam name="TDtoCollectionObject">The interface type of theassignment dbyou entitywant of the related collection<to use</typeparam>
/// <param name="propertyChain">The path from the TDtoObjectTDtoType to the collection of TDtoCollectionObject</param>
/// <param name="filtersubPropertyChain">The path definitionto offthe whatproperty you want to filter< check against the current core identity id</param>
GenericContextCollectionPropertyChainFilter<TDtoObjectGenericMyValidAssignmentFilter<TDtoType, TDtoCollectionObject> (Expression<Func<TDtoObjectExpression<Func<TDtoType, IEnumerable<TDtoCollectionObject>>> propertyChain, ContextPropertyFilter<TDtoCollectionObject> filter)

Example

Code Block
new GenericContextCollectionPropertyChainFilter<IEventHandler, IEventSubscription>(e => e.EventSubscriptions, new ContextPropertyFilter<IEventSubscription>(new[]
{
    new ContextPropertyFilterDefintion<IEventSubscription>(eExpression<Func<TDtoCollectionObject, uint>> subPropertyChain) 

Example:

Code Block
languagec#
new GenericMyValidAssignmentFilter<ICatalogToRoleAssignment, IRoleAssignment>(n => en.EventHandlerRole.IdRoleAssignments, CoreLoginAssignmentContextTypes.OrganizationUnit),
    new ContextPropertyFilterDefintion<IEventSubscription>(en => en.CoreIdentity.Id, CoreLoginAssignmentContextTypes.User)
}));