Table of Contents

Class UserRoles

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

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

[PublicApi]
[VisualQuery(NiceName = "User Roles", Icon = "account_circle", UiHint = "User Roles in this site", HelpLink = "https://go.2sxc.org/ds-roles", NameId = "eee54266-d7ad-4f5e-9422-2d00c8f93b45", Type = DataSourceType.Source, ConfigurationType = "1b9fd9d1-dde0-40ad-bb66-5cd7f30de18d")]
public class UserRoles : CustomDataSource, IDataSource, IAppIdentity, IZoneIdentity, IAppIdentityLight, ICacheKey, ICacheExpiring, ITimestamped, IHasLog, IDataSourceLinkable, IServiceWithSetup<IDataSourceOptions>
Inheritance
object
UserRoles
Implements
IServiceWithSetup<IDataSourceOptions>
Inherited Members

Remarks

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

History

  • Not sure when it was first created, probably early 2023 with the name Roles, and not officially communicated.
  • Model IUserRoleModel created in v19.01 and officially released
  • Renamed to UserRoles for consistency in v19.0 as we believe nobody has been actively using it yet, since the models were missing.

Constructors

UserRoles(Dependencies, IUserRolesProvider)

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

public UserRoles(CustomDataSource.Dependencies services, IUserRolesProvider provider)

Parameters

services CustomDataSource.Dependencies
provider IUserRolesProvider

Remarks

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

History

  • Not sure when it was first created, probably early 2023 with the name Roles, and not officially communicated.
  • Model IUserRoleModel created in v19.01 and officially released
  • Renamed to UserRoles for consistency in v19.0 as we believe nobody has been actively using it yet, since the models were missing.

Properties

ExcludeRoleIds

Optional (single value or comma-separated integers) filter, exclude roles based on roleId

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

Property Value

string

RoleIds

Optional (single value or comma-separated integers) filter, include roles based on roleId

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

Property Value

string

Methods

GetDefault()

Default method called to return data. If the inheriting class overrides this, it can go without having a full constructor.

protected override IEnumerable<IRawData> GetDefault()

Returns

IEnumerable<IRawData>