forked from PeterWaher/IoTGateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPrivilege.cs
More file actions
95 lines (85 loc) · 2.06 KB
/
Privilege.cs
File metadata and controls
95 lines (85 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
using System;
using System.Threading.Tasks;
using Waher.Persistence.Attributes;
namespace Waher.Security.Users
{
/// <summary>
/// Corresponds to a privilege in the system.
/// </summary>
[CollectionName("Privileges")]
[TypeName(TypeNameSerialization.None)]
[Index("LocalId", "ParentFullId")]
[Index("FullId")]
[ArchivingTime]
public class Privilege
{
private string objectId = null;
private string parentFullId = string.Empty;
private string localId = string.Empty;
private string fullId = string.Empty;
private string description = string.Empty;
private Privilege parent = null;
/// <summary>
/// Corresponds to a privilege in the system.
/// </summary>
public Privilege()
{
}
/// <summary>
/// Object ID of privilege
/// </summary>
[ObjectId]
public string ObjectId
{
get => this.objectId;
set => this.objectId = value;
}
/// <summary>
/// Full Privilege ID of parent privilege. If the empty string, privilege is a root privilege.
/// </summary>
public string ParentFullId
{
get => this.parentFullId;
set => this.parentFullId = value;
}
/// <summary>
/// Local Privilege ID, unique among the child privileges of the same parent.
/// </summary>
public string LocalId
{
get => this.localId;
set => this.localId = value;
}
/// <summary>
/// Full Privilege ID. Corresponds to the concatenation of ancestor IDs with the local ID, delimited with period characters.
/// </summary>
public string FullId
{
get => this.fullId;
set => this.fullId = value;
}
/// <summary>
/// Description of privilege.
/// </summary>
[DefaultValueStringEmpty]
public string Description
{
get => this.description;
set => this.description = value;
}
/// <summary>
/// Parent privilege.
/// </summary>
[IgnoreMember]
public Privilege Parent
{
get
{
if (this.parent is null && !string.IsNullOrEmpty(this.parentFullId))
this.parent = Privileges.GetPrivilege(this.parentFullId).Result;
return this.parent;
}
internal set => this.parent = value;
}
}
}