mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Renaming FeaturePermissions to RoleCategoryPermissions
--HG-- branch : dev
This commit is contained in:
@@ -102,11 +102,11 @@ namespace Orchard.Roles.Controllers {
|
|||||||
throw new HttpException(404, "page with id " + id + " was not found");
|
throw new HttpException(404, "page with id " + id + " was not found");
|
||||||
}
|
}
|
||||||
var model = new RoleEditViewModel { Name = role.Name, Id = role.Id,
|
var model = new RoleEditViewModel { Name = role.Name, Id = role.Id,
|
||||||
FeaturePermissions = _roleService.GetInstalledPermissions(),
|
RoleCategoryPermissions = _roleService.GetInstalledPermissions(),
|
||||||
CurrentPermissions = _roleService.GetPermissionsForRole(id)};
|
CurrentPermissions = _roleService.GetPermissionsForRole(id)};
|
||||||
|
|
||||||
var simulation = UserSimulation.Create(role.Name);
|
var simulation = UserSimulation.Create(role.Name);
|
||||||
model.EffectivePermissions = model.FeaturePermissions
|
model.EffectivePermissions = model.RoleCategoryPermissions
|
||||||
.SelectMany(group => group.Value)
|
.SelectMany(group => group.Value)
|
||||||
.Where(permission => _authorizationService.TryCheckAccess(permission, simulation, null))
|
.Where(permission => _authorizationService.TryCheckAccess(permission, simulation, null))
|
||||||
.Select(permission=>permission.Name)
|
.Select(permission=>permission.Name)
|
||||||
|
|||||||
@@ -113,9 +113,9 @@ namespace Orchard.Roles.Services {
|
|||||||
string title = String.IsNullOrWhiteSpace(category) ? T("{0} Feature", featureName).Text : T(category).Text;
|
string title = String.IsNullOrWhiteSpace(category) ? T("{0} Feature", featureName).Text : T(category).Text;
|
||||||
|
|
||||||
if ( installedPermissions.ContainsKey(title) )
|
if ( installedPermissions.ContainsKey(title) )
|
||||||
installedPermissions[title] = installedPermissions[title].Concat( new [] {permission});
|
installedPermissions[title] = installedPermissions[title].Concat( new [] {permission} );
|
||||||
else
|
else
|
||||||
installedPermissions.Add(title, permissions);
|
installedPermissions.Add(title, new[] { permission });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace Orchard.Roles.ViewModels {
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public IDictionary<string, IEnumerable<Permission>> FeaturePermissions { get; set; }
|
public IDictionary<string, IEnumerable<Permission>> RoleCategoryPermissions { get; set; }
|
||||||
public IEnumerable<string> CurrentPermissions { get; set; }
|
public IEnumerable<string> CurrentPermissions { get; set; }
|
||||||
public IEnumerable<string> EffectivePermissions { get; set; }
|
public IEnumerable<string> EffectivePermissions { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>@T("Permissions")</legend>
|
<legend>@T("Permissions")</legend>
|
||||||
@foreach (var category in Model.FeaturePermissions.Keys) {
|
@foreach (var category in Model.RoleCategoryPermissions.Keys) {
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>@category</legend>
|
<legend>@category</legend>
|
||||||
<table class="items">
|
<table class="items">
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
<th scope="col">@T("Effective")</th>
|
<th scope="col">@T("Effective")</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@foreach (var permission in Model.FeaturePermissions[category]) {
|
@foreach (var permission in Model.RoleCategoryPermissions[category]) {
|
||||||
<tr>
|
<tr>
|
||||||
<td>@permission.Description</td>
|
<td>@permission.Description</td>
|
||||||
<td style="width:60px;">
|
<td style="width:60px;">
|
||||||
|
|||||||
Reference in New Issue
Block a user