Class UserGroup
Represents a Group for a Backoffice User
Namespace: Umbraco.Cms.Core.Models.Membership
Assembly: Umbraco.Core.dll
Syntax
[DataContract(IsReference = true)]
public class UserGroup : EntityBase, IUserGroup, IEntity, IDeepCloneable, IRememberBeingDirty, ICanBeDirty, IReadOnlyUserGroup
Constructors
View SourceUserGroup(IShortStringHelper)
Constructor to create a new user group
Declaration
public UserGroup(IShortStringHelper shortStringHelper)
Parameters
| Type | Name | Description |
|---|---|---|
| IShortStringHelper | shortStringHelper | The short string helper for alias processing. |
UserGroup(IShortStringHelper, int, string?, string?, string?)
Constructor to create an existing user group.
Declaration
public UserGroup(IShortStringHelper shortStringHelper, int userCount, string? alias, string? name, string? icon)
Parameters
| Type | Name | Description |
|---|---|---|
| IShortStringHelper | shortStringHelper | The short string helper. |
| int | userCount | The user count. |
| string | alias | The alias. |
| string | name | The name. |
| string | icon | The icon. |
Properties
View SourceAlias
Gets or sets the alias of the user group.
Declaration
[DataMember]
public string Alias { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
AllowedLanguages
Gets the collection of language IDs that this user group has access to.
Declaration
public IEnumerable<int> AllowedLanguages { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<int> |
AllowedSections
Gets the collection of section aliases that this user group has access to.
Declaration
public IEnumerable<string> AllowedSections { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<string> |
Description
Gets or sets the description of the user group.
Declaration
[DataMember]
public string? Description { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
TODO (V18): Remove the default implementations.
GranularPermissions
Gets or sets the granular permissions for this user group.
Declaration
public ISet<IGranularPermission> GranularPermissions { get; set; }
Property Value
| Type | Description |
|---|---|
| ISet<IGranularPermission> |
HasAccessToAllLanguages
If this property is true it will give the group access to all languages
Declaration
[DataMember]
public bool HasAccessToAllLanguages { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Icon
The icon
Declaration
[DataMember]
public string? Icon { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Name
The name
Declaration
[DataMember]
public string? Name { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Permissions
The set of permissions provided by the frontend.
Declaration
public ISet<string> Permissions { get; set; }
Property Value
| Type | Description |
|---|---|
| ISet<string> |
Remarks
By default the server has no concept of what all of these strings mean, we simple store them and return them to the UI.
StartContentId
Gets or sets the starting content node ID for this user group.
Declaration
[DataMember]
public int? StartContentId { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
StartMediaId
Gets or sets the starting media node ID for this user group.
Declaration
[DataMember]
public int? StartMediaId { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
UserCount
Specifies the number of users assigned to this group
Declaration
public int UserCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
View SourceAddAllowedLanguage(int)
Adds access to a language for this user group.
Declaration
public void AddAllowedLanguage(int languageId)
Parameters
| Type | Name | Description |
|---|---|---|
| int | languageId | The ID of the language to add. |
AddAllowedSection(string)
Adds access to a section for this user group.
Declaration
public void AddAllowedSection(string sectionAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sectionAlias | The alias of the section to add. |
ClearAllowedLanguages()
Removes access to all languages for this user group.
Declaration
public void ClearAllowedLanguages()
ClearAllowedSections()
Removes access to all sections for this user group.
Declaration
public void ClearAllowedSections()
PerformDeepClone(object)
Used by inheritors to modify the DeepCloning logic
Declaration
protected override void PerformDeepClone(object clone)
Parameters
| Type | Name | Description |
|---|---|---|
| object | clone |
RemoveAllowedLanguage(int)
Removes access to a language for this user group.
Declaration
public void RemoveAllowedLanguage(int languageId)
Parameters
| Type | Name | Description |
|---|---|---|
| int | languageId | The ID of the language to remove. |
RemoveAllowedSection(string)
Removes access to a section for this user group.
Declaration
public void RemoveAllowedSection(string sectionAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sectionAlias | The alias of the section to remove. |