mirror of
				https://github.com/OrchardCMS/Orchard.git
				synced 2025-10-31 00:26:39 +08:00 
			
		
		
		
	16965 Remove tenant permission
--HG-- branch : dev
This commit is contained in:
		| @@ -1,5 +1,6 @@ | ||||
| using Orchard.Environment.Configuration; | ||||
| using Orchard.Localization; | ||||
| using Orchard.Security; | ||||
| using Orchard.UI.Navigation; | ||||
|  | ||||
| namespace Orchard.MultiTenancy { | ||||
| @@ -20,7 +21,7 @@ namespace Orchard.MultiTenancy { | ||||
|  | ||||
|             builder.Add(T("Tenants"), "100", | ||||
|                 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.MultiTenancy.Services; | ||||
| using Orchard.MultiTenancy.ViewModels; | ||||
| using Orchard.Security; | ||||
| using Orchard.UI.Notify; | ||||
|  | ||||
| namespace Orchard.MultiTenancy.Controllers { | ||||
| @@ -29,7 +30,7 @@ namespace Orchard.MultiTenancy.Controllers { | ||||
|         } | ||||
|  | ||||
|         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(); | ||||
|  | ||||
|             if ( !EnsureDefaultTenant() ) | ||||
| @@ -41,7 +42,7 @@ namespace Orchard.MultiTenancy.Controllers { | ||||
|         [HttpPost, ActionName("Add")] | ||||
|         public ActionResult AddPOST(TenantAddViewModel viewModel) { | ||||
|             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(); | ||||
|  | ||||
|                 if ( !EnsureDefaultTenant() ) | ||||
| @@ -67,7 +68,7 @@ namespace Orchard.MultiTenancy.Controllers { | ||||
|         } | ||||
|  | ||||
|         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(); | ||||
|  | ||||
|             if ( !EnsureDefaultTenant() ) | ||||
| @@ -91,7 +92,7 @@ namespace Orchard.MultiTenancy.Controllers { | ||||
|         [HttpPost, ActionName("Edit")] | ||||
|         public ActionResult EditPost(TenantEditViewModel viewModel) { | ||||
|             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(); | ||||
|  | ||||
|                 if ( !EnsureDefaultTenant() ) | ||||
| @@ -122,7 +123,7 @@ namespace Orchard.MultiTenancy.Controllers { | ||||
|  | ||||
|         [HttpPost] | ||||
|         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(); | ||||
|  | ||||
|             if ( !EnsureDefaultTenant() ) | ||||
| @@ -140,7 +141,7 @@ namespace Orchard.MultiTenancy.Controllers { | ||||
|  | ||||
|         [HttpPost] | ||||
|         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(); | ||||
|  | ||||
|             if ( !EnsureDefaultTenant() ) | ||||
|   | ||||
| @@ -63,7 +63,6 @@ | ||||
|     <Compile Include="ViewModels\TenantEditViewModel.cs" /> | ||||
|     <Compile Include="ViewModels\TenantAddViewModel.cs" /> | ||||
|     <Compile Include="ViewModels\TenantsIndexViewModel.cs" /> | ||||
|     <Compile Include="Permissions.cs" /> | ||||
|     <Compile Include="Properties\AssemblyInfo.cs" /> | ||||
|   </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} | ||||
|                 }, | ||||
|             }; | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Suha Can
					Suha Can