Table of Contents

Class Users

Namespace
ToSic.Sxc.DataSources
Assembly
ToSic.Sxc.dll

Will get all (or just some) users of the current site.

[PublicApi]
[VisualQuery(NiceName = "Users", Icon = "account_circle", UiHint = "Users in this site", HelpLink = "https://go.2sxc.org/ds-users", NameId = "93ac53c6-adc6-4218-b979-48d1071a5765", Type = DataSourceType.Source, ConfigurationType = "ac11fae7-1916-4d2d-8583-09872e1e6966")]
public class Users : CustomDataSourceAdvanced, IDataSource, IAppIdentity, IZoneIdentity, IAppIdentityLight, ICacheKey, ICacheExpiring, ITimestamped, IHasLog, IDataSourceLinkable
Inheritance
object
ServiceBase
Users
Implements
Inherited Members

Remarks

You can cast the result to IUserModel for typed use in your code. To figure out the returned properties, best also consult the IUserModel.

The resulting Entity will almost match the ToSic.Eav.Context.IUser interface.

History

  • Created ca. v.16 early 2023 but not officially communicated
  • Models IUserModel and IUserRoleModel created in v19.01 and officially released

Properties

AddRoles

Add property Roles as a relationship to role entities.

[Configuration(Fallback = true)]
public bool AddRoles { get; set; }

Property Value

bool

Remarks

  • Added v15.03 - minimal breaking change, before the source return a non-standard RoleIds string-array.

ExcludeRoleIds

Optional ExcludeRolesFilter (single value or comma-separated integers) filter, exclude users that have any of roles from filter

[Configuration]
public string ExcludeRoleIds { get; set; }

Property Value

string

ExcludeUserIds

Optional exclude Users (single value or comma-separated guids or integers) filter, exclude users based on guid or id

[Configuration]
public string ExcludeUserIds { get; set; }

Property Value

string

IncludeSystemAdmins

Optional SystemAdmins filter.

  • true - with System Admins
  • false - without System Admins
  • required - only System Admins (no normal users)
[Configuration]
public string IncludeSystemAdmins { get; set; }

Property Value

string

Remarks

  • Changed to be string in v15.03 (before bool) to allow more options such as required

RoleIds

Optional IncludeRolesFilter (single value or comma-separated integers) filter, include users that have any of roles from filter

[Configuration]
public string RoleIds { get; set; }

Property Value

string

UserIds

Optional Users (single value or comma-separated guids or integers) filter, include users based on guid or id

[Configuration]
public string UserIds { get; set; }

Property Value

string