• Basics
  • Abyss
  • Web APIs
  • C# & Razor
  • .net API
  • JS & TS API

    Show / Hide Table of Contents

    Class OwnerFilter

    Filter entities to show only these belonging to a specific user.

    The OwnerFilter DataSource is part of the Standard EAV Data Sources. It will only let items pass through, which a specific user (often the current one) has created initially.

    You will typically use the OwnerFilter in scenarios where users create their own data, and should only see/edit items which they own (usually in combination with security settings, which only allow the owner to modify their own items).

    How to use with the VisualQuery

    When using the VisualQuery you can just drag it into your query. You must then edit the settings once - and usually you will use the recommended prefilled-form. But you can also do something different. This is what it usually looks like:

    The above example shows:

    1. a content-type filter limiting the items to type Company
    2. an owner-filter which receives 5 items, but only lets 3 pass, because the Test Settings have a demo-value of the user who only created 3 of the 5 items.

    Programming With The OwnerFilter DataSource

    We recommend to use the VisualQuery where possible, as it's easier to understand and is identical for C# and JavaScript. It's also better because it separates data-retrieval from visualization.

    Read also

    • DataSource / DataStream
    • List of all EAV Data Sources
    • Query / VisualQuery

    Demo App and further links

    You should find some examples in this demo App

    • Demo App with examples for most DataSources

    History

    1. Introduced in EAV 3.x, 2sxc ?

    API Documentation

    Inheritance
    System.Object
    ToSic.Lib.Services.ServiceBase
    ToSic.Lib.Services.ServiceBase<ToSic.Eav.DataSource.DataSourceBase.MyServices>
    DataSourceBase
    OwnerFilter
    Implements
    IDataSource
    IAppIdentity
    IZoneIdentity
    IAppIdentityLight
    ICacheKey
    ICacheExpiring
    ITimestamped
    IHasLog
    IDataSourceLinkable
    Inherited Members
    DataSourceBase.AppId
    DataSourceBase.ZoneId
    DataSourceBase.Guid
    DataSourceBase.Error
    DataSourceBase.CacheTimestamp
    DataSourceBase.CacheChanged(Int64)
    DataSourceBase.Configuration
    DataSourceBase.Link
    DataSourceBase.In
    DataSourceBase.TryGetIn(String)
    DataSourceBase.TryGetOut(String)
    DataSourceBase.Out
    DataSourceBase.Item[String]
    DataSourceBase.GetStream(String, String, Boolean, Boolean)
    DataSourceBase.List
    DataSourceBase.Attach(IDataSource)
    DataSourceBase.Attach(String, IDataSource, String)
    DataSourceBase.Attach(String, IDataStream)
    DataSourceBase.ProvideOut(Func<IEnumerable<IEntity>>, String)
    DataSourceBase.ProvideOut(Func<IImmutableList<IEntity>>, String)
    Namespace: ToSic.Eav.DataSources
    Assembly: ToSic.Eav.DataSources.dll
    Syntax
    [PublicApi_Stable_ForUseInYourCode]
    [VisualQuery(NiceName = "Owner Filter", UiHint = "Keep only item created by a specified user", Icon = "attribution", Type = DataSourceType.Security, NameId = "ToSic.Eav.DataSources.OwnerFilter, ToSic.Eav.DataSources", DynamicOut = false, In = new string[]{"Default*"}, ConfigurationType = "|Config ToSic.Eav.DataSources.OwnerFilter", HelpLink = "https://r.2sxc.org/DsOwnerFilter")]
    public class OwnerFilter : DataSourceBase, IDataSource, IAppIdentity, IZoneIdentity, IAppIdentityLight, ICacheInfo, ICacheKey, ICacheExpiring, ITimestamped, ICanPurgeListCache, IHasLog, IDataTarget, IAppIdentitySync, IDataSourceLinkable
    Remarks

    Had a major, breaking update in v15. Consult the guide to upgrade your custom data sources.

    Properties

    | Improve this Doc View Source

    Identity

    The identity of the user to filter by. Uses the Identity-token convention like dnn:1 is the user #1 in the DNN DB

    Declaration
    [Configuration(Field = "IdentityCode")]
    public string Identity { get; set; }
    Property Value
    Type Description
    System.String

    Implements

    IDataSource
    IAppIdentity
    IZoneIdentity
    IAppIdentityLight
    ICacheKey
    ICacheExpiring
    ITimestamped
    IHasLog
    IDataSourceLinkable
    • Improve this Doc
    • View Source
    Back to top Generated by DocFX