Versions Compared

Key

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

...

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

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 to the property that will be compared it to the current core identity id</param>
GenericMyCoreIdentityFilter<TDtoObject> (Expression<Func<TDtoObject, uint>> propertyChain)
GenericMyCoreIdentityStringValueFilter<TDtoObject> (Expression<Func<TDtoObject, string>> propertyChain) 

Example:

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

...

This filter gives you permission for the entity type only when your core identity id 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="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="subPropertyChain">The path to the property that will be compared to the current core identity id</param>
GenericMyCoreIdentityCollectionFilter<TDtoObject, TDtoCollectionObject> (Expression<Func<TDtoObject, IEnumerable<TDtoCollectionObject>>> propertyChain, Expression<Func<TDtoCollectionObject, uint>> subPropertyChain

Example:

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

My user filters

GenericMyUserValueFilter/ GenericMyUserStringValueFilter

This filter gives you permission for the entity type only when your user 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="propertyChain">The path to the property that will be compared it to the current user id</param>
GenericMyUserValueFilter<TDtoObject> (Expression<Func<TDtoObject, uint>> propertyChain)
GenericMyCoreIdentityStringValueFilter<TDtoObject> (Expression<Func<TDtoObject, string>> propertyChain)

Example:

Code Block
languagec#
new GenericMyUserValueFilter<IUser>(u => u.Id)

GenericMyUserCollectionFilter

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

Code Block
/// <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="subPropertyChain">The path to the property that will be compared it to the current user id</param>
GenericMyUserCollectionFilter<TDtoObject, TDtoCollectionObject> (Expression<Func<TDtoObject, IEnumerable<TDtoCollectionObject>>> propertyChain, Expression<Func<TDtoCollectionObject, uint>> subPropertyChain)

Example:

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

GenericMyUserValueFilter/ GenericMyUserStringValueFilter

...

Context filter

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
/// <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 GenericMyUserValueFilter<IUser>ContextPropertyFilterDefintion<IEventHandler>(ue => ue.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
/// <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
new GenericContextPropertyChainFilter<IEventHandler>(new ContextPropertyFilter<IEventHandler>(new[]
{
    new ContextPropertyFilterDefintion<IEventHandler>(e => e.EventHandlerType.Id, CoreLoginAssignmentContextTypes.OrganizationUnit),
    new ContextPropertyFilterDefintion<IEventHandler>(e => e.Id, CoreLoginAssignmentContextTypes.User)
}));

...

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
/// <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, TDtoCollectionObject> (Expression<Func<TDtoObject, IEnumerable<TDtoCollectionObject>>> propertyChain, ContextPropertyFilter<TDtoCollectionObject> filter)

Example

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

...