< Summary - Jellyfin

Information
Class: Jellyfin.Data.Entities.Permission
Assembly: Jellyfin.Data
File(s): /srv/git/jellyfin/Jellyfin.Data/Entities/Permission.cs
Line coverage
60%
Covered lines: 3
Uncovered lines: 2
Coverable lines: 5
Total lines: 68
Line coverage: 60%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
OnSavingChanges()100%210%

File(s)

/srv/git/jellyfin/Jellyfin.Data/Entities/Permission.cs

#LineLine coverage
 1#pragma warning disable CA1711 // Identifiers should not have incorrect suffix
 2
 3using System;
 4using System.ComponentModel.DataAnnotations;
 5using System.ComponentModel.DataAnnotations.Schema;
 6using Jellyfin.Data.Enums;
 7using Jellyfin.Data.Interfaces;
 8
 9namespace Jellyfin.Data.Entities
 10{
 11    /// <summary>
 12    /// An entity representing whether the associated user has a specific permission.
 13    /// </summary>
 14    public class Permission : IHasConcurrencyToken
 15    {
 16        /// <summary>
 17        /// Initializes a new instance of the <see cref="Permission"/> class.
 18        /// Public constructor with required data.
 19        /// </summary>
 20        /// <param name="kind">The permission kind.</param>
 21        /// <param name="value">The value of this permission.</param>
 22        public Permission(PermissionKind kind, bool value)
 23        {
 93624            Kind = kind;
 93625            Value = value;
 93626        }
 27
 28        /// <summary>
 29        /// Gets the id of this permission.
 30        /// </summary>
 31        /// <remarks>
 32        /// Identity, Indexed, Required.
 33        /// </remarks>
 34        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
 35        public int Id { get; private set; }
 36
 37        /// <summary>
 38        /// Gets or sets the id of the associated user.
 39        /// </summary>
 40        public Guid? UserId { get; set; }
 41
 42        /// <summary>
 43        /// Gets the type of this permission.
 44        /// </summary>
 45        /// <remarks>
 46        /// Required.
 47        /// </remarks>
 48        public PermissionKind Kind { get; private set; }
 49
 50        /// <summary>
 51        /// Gets or sets a value indicating whether the associated user has this permission.
 52        /// </summary>
 53        /// <remarks>
 54        /// Required.
 55        /// </remarks>
 56        public bool Value { get; set; }
 57
 58        /// <inheritdoc />
 59        [ConcurrencyCheck]
 60        public uint RowVersion { get; private set; }
 61
 62        /// <inheritdoc/>
 63        public void OnSavingChanges()
 64        {
 065            RowVersion++;
 066        }
 67    }
 68}