-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathPermissions.cs
68 lines (58 loc) · 3.08 KB
/
Permissions.cs
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
using System.Collections.Generic;
using Orchard.Environment.Extensions.Models;
using Orchard.Security.Permissions;
namespace NGM.Forum {
public class Permissions : IPermissionProvider {
public static readonly Permission ManageForums = new Permission { Description = "Manage forums for others", Name = "ManageForums" };
public static readonly Permission ManageOwnForums = new Permission { Description = "Manage own forums", Name = "ManageOwnForums", ImpliedBy = new[] { ManageForums } };
public static readonly Permission MoveThread = new Permission { Description = "Move any thread to another forum", Name = "MoveThread" };
public static readonly Permission MoveOwnThread = new Permission { Description = "Move your own thread to another forum", Name = "MoveOwnThread", ImpliedBy = new[] { MoveThread }};
public static readonly Permission StickyThread = new Permission { Description = "Allows you to mark any thread as Sticky", Name = "StickyThread" };
public static readonly Permission StickyOwnThread = new Permission { Description = "Allows you to mark your own thread as Sticky", Name = "StickyOwnThread", ImpliedBy = new[] { StickyThread } };
public static readonly Permission CloseThread = new Permission { Description = "Allows you to close any thread", Name = "CloseThread" };
public static readonly Permission CloseOwnThread = new Permission { Description = "Allows you to close your own thread", Name = "CloseOwnThread", ImpliedBy = new[] { CloseThread }};
public virtual Feature Feature { get; set; }
public IEnumerable<Permission> GetPermissions() {
return new[] {
ManageForums,
ManageOwnForums,
MoveOwnThread,
MoveThread,
StickyOwnThread,
StickyThread,
CloseOwnThread,
CloseThread,
};
}
public IEnumerable<PermissionStereotype> GetDefaultStereotypes() {
return new[] {
new PermissionStereotype {
Name = "Administrator",
Permissions = new[] {ManageForums}
},
new PermissionStereotype {
Name = "Editor",
Permissions = new[] {ManageForums}
},
new PermissionStereotype {
Name = "Moderator",
Permissions = new[] {ManageForums}
},
new PermissionStereotype {
Name = "Author",
Permissions = new[] {ManageOwnForums}
},
new PermissionStereotype {
Name = "Contributor",
},
/*Need to handle*/
new PermissionStereotype {
Name = "Anonymous",
},
new PermissionStereotype {
Name = "Authenticated",
},
};
}
}
}