mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
31 lines
1.1 KiB
C#
31 lines
1.1 KiB
C#
using System.Collections.Generic;
|
|
using JetBrains.Annotations;
|
|
using Orchard.Environment.Extensions.Models;
|
|
using Orchard.Security.Permissions;
|
|
|
|
namespace Orchard.Roles {
|
|
[UsedImplicitly]
|
|
public class Permissions : IPermissionProvider {
|
|
public static readonly Permission ManageRoles = new Permission { Description = "Create and manage roles", Name = "ManageRoles" };
|
|
public static readonly Permission ApplyRoles = new Permission { Description = "Assign users to roles", Name = "AssignUsersToRoles", ImpliedBy = new[] { ManageRoles } };
|
|
|
|
public virtual Feature Feature { get; set; }
|
|
|
|
public IEnumerable<Permission> GetPermissions() {
|
|
return new[] {
|
|
ManageRoles,
|
|
ApplyRoles,
|
|
};
|
|
}
|
|
|
|
public IEnumerable<PermissionStereotype> GetDefaultStereotypes() {
|
|
return new[] {
|
|
new PermissionStereotype {
|
|
Name = "Administrator",
|
|
Permissions = new[] {ManageRoles, ApplyRoles}
|
|
}
|
|
};
|
|
}
|
|
}
|
|
}
|