mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-05 21:01:35 +08:00
16965 Remove tenant permission
--HG-- branch : dev
This commit is contained in:
parent
65695a4acf
commit
7d31f16dab
@ -1,5 +1,6 @@
|
|||||||
using Orchard.Environment.Configuration;
|
using Orchard.Environment.Configuration;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
|
using Orchard.Security;
|
||||||
using Orchard.UI.Navigation;
|
using Orchard.UI.Navigation;
|
||||||
|
|
||||||
namespace Orchard.MultiTenancy {
|
namespace Orchard.MultiTenancy {
|
||||||
@ -20,7 +21,7 @@ namespace Orchard.MultiTenancy {
|
|||||||
|
|
||||||
builder.Add(T("Tenants"), "100",
|
builder.Add(T("Tenants"), "100",
|
||||||
menu => menu.Add(T("List"), "0", item => item.Action("Index", "Admin", new { area = "Orchard.MultiTenancy" })
|
menu => menu.Add(T("List"), "0", item => item.Action("Index", "Admin", new { area = "Orchard.MultiTenancy" })
|
||||||
.Permission(Permissions.ManageTenants)));
|
.Permission(StandardPermissions.SiteOwner)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ using Orchard.Environment.Configuration;
|
|||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using Orchard.MultiTenancy.Services;
|
using Orchard.MultiTenancy.Services;
|
||||||
using Orchard.MultiTenancy.ViewModels;
|
using Orchard.MultiTenancy.ViewModels;
|
||||||
|
using Orchard.Security;
|
||||||
using Orchard.UI.Notify;
|
using Orchard.UI.Notify;
|
||||||
|
|
||||||
namespace Orchard.MultiTenancy.Controllers {
|
namespace Orchard.MultiTenancy.Controllers {
|
||||||
@ -29,7 +30,7 @@ namespace Orchard.MultiTenancy.Controllers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult Add() {
|
public ActionResult Add() {
|
||||||
if (!Services.Authorizer.Authorize(Permissions.ManageTenants, T("Cannot create tenant")))
|
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Cannot create tenant")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
if ( !EnsureDefaultTenant() )
|
if ( !EnsureDefaultTenant() )
|
||||||
@ -41,7 +42,7 @@ namespace Orchard.MultiTenancy.Controllers {
|
|||||||
[HttpPost, ActionName("Add")]
|
[HttpPost, ActionName("Add")]
|
||||||
public ActionResult AddPOST(TenantAddViewModel viewModel) {
|
public ActionResult AddPOST(TenantAddViewModel viewModel) {
|
||||||
try {
|
try {
|
||||||
if (!Services.Authorizer.Authorize(Permissions.ManageTenants, T("Couldn't create tenant")))
|
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Couldn't create tenant")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
if ( !EnsureDefaultTenant() )
|
if ( !EnsureDefaultTenant() )
|
||||||
@ -67,7 +68,7 @@ namespace Orchard.MultiTenancy.Controllers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult Edit(string name) {
|
public ActionResult Edit(string name) {
|
||||||
if (!Services.Authorizer.Authorize(Permissions.ManageTenants, T("Cannot edit tenant")))
|
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Cannot edit tenant")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
if ( !EnsureDefaultTenant() )
|
if ( !EnsureDefaultTenant() )
|
||||||
@ -91,7 +92,7 @@ namespace Orchard.MultiTenancy.Controllers {
|
|||||||
[HttpPost, ActionName("Edit")]
|
[HttpPost, ActionName("Edit")]
|
||||||
public ActionResult EditPost(TenantEditViewModel viewModel) {
|
public ActionResult EditPost(TenantEditViewModel viewModel) {
|
||||||
try {
|
try {
|
||||||
if (!Services.Authorizer.Authorize(Permissions.ManageTenants, T("Couldn't edit tenant")))
|
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Couldn't edit tenant")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
if ( !EnsureDefaultTenant() )
|
if ( !EnsureDefaultTenant() )
|
||||||
@ -122,7 +123,7 @@ namespace Orchard.MultiTenancy.Controllers {
|
|||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Disable(string name) {
|
public ActionResult Disable(string name) {
|
||||||
if (!Services.Authorizer.Authorize(Permissions.ManageTenants, T("Couldn't disable tenant")))
|
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Couldn't disable tenant")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
if ( !EnsureDefaultTenant() )
|
if ( !EnsureDefaultTenant() )
|
||||||
@ -140,7 +141,7 @@ namespace Orchard.MultiTenancy.Controllers {
|
|||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Enable(string name) {
|
public ActionResult Enable(string name) {
|
||||||
if (!Services.Authorizer.Authorize(Permissions.ManageTenants, T("Couldn't enable tenant")))
|
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Couldn't enable tenant")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
if ( !EnsureDefaultTenant() )
|
if ( !EnsureDefaultTenant() )
|
||||||
|
@ -63,7 +63,6 @@
|
|||||||
<Compile Include="ViewModels\TenantEditViewModel.cs" />
|
<Compile Include="ViewModels\TenantEditViewModel.cs" />
|
||||||
<Compile Include="ViewModels\TenantAddViewModel.cs" />
|
<Compile Include="ViewModels\TenantAddViewModel.cs" />
|
||||||
<Compile Include="ViewModels\TenantsIndexViewModel.cs" />
|
<Compile Include="ViewModels\TenantsIndexViewModel.cs" />
|
||||||
<Compile Include="Permissions.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using Orchard.Environment.Extensions.Models;
|
|
||||||
using Orchard.Security.Permissions;
|
|
||||||
|
|
||||||
namespace Orchard.MultiTenancy {
|
|
||||||
public class Permissions : IPermissionProvider {
|
|
||||||
public static readonly Permission ManageTenants = new Permission { Description = "Modifying Tenants of a Site", Name = "ManageTenants" };
|
|
||||||
|
|
||||||
public virtual Feature Feature { get; set; }
|
|
||||||
|
|
||||||
public IEnumerable<Permission> GetPermissions() {
|
|
||||||
return new[] {
|
|
||||||
ManageTenants
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<PermissionStereotype> GetDefaultStereotypes() {
|
|
||||||
return new[] {
|
|
||||||
new PermissionStereotype {
|
|
||||||
Name = "Administrator",
|
|
||||||
Permissions = new[] {ManageTenants}
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user