-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPermissions.cs
48 lines (41 loc) · 1.81 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
using System.Collections.Generic;
using Orchard.Environment.Extensions.Models;
using Orchard.Security.Permissions;
namespace Windsong.VersionManager
{
public class Permissions : IPermissionProvider
{
public static readonly Permission SetReadOnlyStateForContent = new Permission { Description = "Manage Read Only state for any content item", Name = "SetReadOnlyStateForContent" };
public static readonly Permission SetReadOnlyStateForOwnContent = new Permission { Description = "Lock or Unlock own content", Name = "SetReadOnlyStateForOwnContent", ImpliedBy = new[] { SetReadOnlyStateForContent } };
public static readonly Permission MetaListContent = new Permission { ImpliedBy = new[] { SetReadOnlyStateForOwnContent } };
public virtual Feature Feature { get; set; }
public IEnumerable<Permission> GetPermissions()
{
return new[] {
SetReadOnlyStateForOwnContent,
SetReadOnlyStateForContent
};
}
public IEnumerable<PermissionStereotype> GetDefaultStereotypes()
{
return new[] {
new PermissionStereotype {
Name = "Administrator",
Permissions = new[] {SetReadOnlyStateForContent}
},
new PermissionStereotype {
Name = "Editor",
Permissions = new[] {SetReadOnlyStateForContent}
},
new PermissionStereotype {
Name = "Author",
Permissions = new[] {SetReadOnlyStateForOwnContent}
},
new PermissionStereotype {
Name = "Contributor",
Permissions = new[] {SetReadOnlyStateForOwnContent}
}
};
}
}
}