-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathRoleModel.cs
More file actions
107 lines (84 loc) · 3 KB
/
RoleModel.cs
File metadata and controls
107 lines (84 loc) · 3 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
96
97
98
99
100
101
102
103
104
105
106
107
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Contentstack.Management.Core.Models
{
[JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)]
public class RoleModel
{
[JsonProperty(propertyName: "name")]
public string Name { get; set; }
[JsonProperty(propertyName: "description")]
public string Description { get; set; }
[JsonProperty(propertyName: "rules")]
public List<Rule> Rules { get; set; }
[JsonProperty(propertyName: "deploy_content")]
public bool DeployContent { get; set; } = true;
}
public class Rule
{
[JsonProperty(propertyName: "acl")]
public Dictionary<string, object> ACL { get; }
[JsonProperty(propertyName: "restrict")]
public bool Restrict { get; }
}
public class ContentTypeRules: Rule
{
[JsonProperty(propertyName: "module")]
public string Module { get; } = "content_type";
[JsonProperty(propertyName: "content_types")]
public List<string> ContentTypes { get; set; }
}
public class BranchRules : Rule
{
[JsonProperty(propertyName: "module")]
public string Module { get; } = "branch";
[JsonProperty(propertyName: "branches")]
public List<string> Branches { get; set; }
}
public class BranchAliasRules : Rule
{
[JsonProperty(propertyName: "module")]
public string Module { get; } = "branch_alias";
[JsonProperty(propertyName: "branch_aliases")]
public List<string> BranchAliases { get; set; }
}
public class AssetRules : Rule
{
[JsonProperty(propertyName: "module")]
public string Module { get; } = "asset";
[JsonProperty(propertyName: "assets")]
public List<string> Assets { get; set; }
}
public class FolderRules : Rule
{
[JsonProperty(propertyName: "module")]
public string Module { get; } = "folder";
[JsonProperty(propertyName: "folders")]
public List<string> Folders { get; set; }
}
public class EnvironmentRules : Rule
{
[JsonProperty(propertyName: "module")]
public string Module { get; } = "environment";
[JsonProperty(propertyName: "environments")]
public List<string> Environments { get; set; }
}
public class TaxonomyContentType
{
[JsonProperty(propertyName: "uid")]
public string Uid { get; set; }
[JsonProperty(propertyName: "acl")]
public Dictionary<string, object> ACL { get; }
}
public class TaxonomyRules : Rule
{
[JsonProperty(propertyName: "module")]
public string Module { get; } = "taxonomy";
[JsonProperty(propertyName: "taxonomies")]
public List<string> Taxonomies { get; set; }
[JsonProperty(propertyName: "terms")]
public List<string> Terms { get; set; }
[JsonProperty(propertyName: "content_types")]
public List<TaxonomyContentType> ContentTypes { get; set; }
}
}