diff --git a/Jellyfin.Data/Entities/Group.cs b/Jellyfin.Data/Entities/Group.cs
index b71a1bd786..5cbb126f9d 100644
--- a/Jellyfin.Data/Entities/Group.cs
+++ b/Jellyfin.Data/Entities/Group.cs
@@ -7,15 +7,26 @@ using Jellyfin.Data.Enums;
namespace Jellyfin.Data.Entities
{
+ ///
+ /// An entity representing a group.
+ ///
public partial class Group : IHasPermissions, ISavingChanges
{
- partial void Init();
-
///
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the class.
+ /// Public constructor with required data.
///
- protected Group()
+ /// The name of the group.
+ public Group(string name)
{
+ if (string.IsNullOrEmpty(name))
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+
+ Name = name;
+ Id = Guid.NewGuid();
+
Permissions = new HashSet();
ProviderMappings = new HashSet();
Preferences = new HashSet();
@@ -24,59 +35,45 @@ namespace Jellyfin.Data.Entities
}
///
- /// Public constructor with required data
+ /// Initializes a new instance of the class.
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
///
- ///
- ///
- public Group(string name, User user)
+ protected Group()
{
- if (string.IsNullOrEmpty(name))
- {
- throw new ArgumentNullException(nameof(name));
- }
-
- this.Name = name;
- user.Groups.Add(this);
-
- this.Permissions = new HashSet();
- this.ProviderMappings = new HashSet();
- this.Preferences = new HashSet();
-
Init();
}
- ///
- /// Static create function (for use in LINQ queries, etc.)
- ///
- ///
- ///
- public static Group Create(string name, User user)
- {
- return new Group(name, user);
- }
-
/*************************************************************************
* Properties
*************************************************************************/
///
- /// Identity, Indexed, Required
+ /// Gets or sets the id of this group.
///
+ ///
+ /// Identity, Indexed, Required.
+ ///
[Key]
[Required]
public Guid Id { get; protected set; }
///
- /// Required, Max length = 255
+ /// Gets or sets the group's name.
///
+ ///
+ /// Required, Max length = 255.
+ ///
[Required]
[MaxLength(255)]
[StringLength(255)]
public string Name { get; set; }
///
- /// Required, ConcurrenyToken
+ /// Gets or sets the row version.
///
+ ///
+ /// Required, Concurrency Token.
+ ///
[ConcurrencyCheck]
[Required]
public uint RowVersion { get; set; }
@@ -99,14 +96,27 @@ namespace Jellyfin.Data.Entities
[ForeignKey("Preference_Preferences_Id")]
public virtual ICollection Preferences { get; protected set; }
+ ///
+ /// Static create function (for use in LINQ queries, etc.)
+ ///
+ /// The name of this group
+ public static Group Create(string name)
+ {
+ return new Group(name);
+ }
+
+ ///
public bool HasPermission(PermissionKind kind)
{
return Permissions.First(p => p.Kind == kind).Value;
}
+ ///
public void SetPermission(PermissionKind kind, bool value)
{
Permissions.First(p => p.Kind == kind).Value = value;
}
+
+ partial void Init();
}
}