1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-12 00:28:11 -05:00

limit edit functions to cloud hosted

This commit is contained in:
Kyle Spearrin 2018-03-23 09:44:48 -04:00
parent bd3457fc06
commit 2cf9127ef1
7 changed files with 11 additions and 4 deletions

View File

@ -7,6 +7,7 @@ using Bit.Admin.Models;
using System.Collections.Generic;
using Bit.Core.Models.Table;
using Bit.Core;
using Bit.Core.Utilities;
namespace Bit.Admin.Controllers
{
@ -65,6 +66,7 @@ namespace Bit.Admin.Controllers
return View(new OrganizationViewModel(organization, users));
}
[SelfHosted(NotSelfHostedOnly = true)]
public async Task<IActionResult> Edit(Guid id)
{
var organization = await _organizationRepository.GetByIdAsync(id);
@ -79,6 +81,7 @@ namespace Bit.Admin.Controllers
[HttpPost]
[ValidateAntiForgeryToken]
[SelfHosted(NotSelfHostedOnly = true)]
public async Task<IActionResult> Edit(Guid id, OrganizationEditModel model)
{
var organization = await _organizationRepository.GetByIdAsync(id);

View File

@ -7,6 +7,7 @@ using Bit.Admin.Models;
using System.Collections.Generic;
using Bit.Core.Models.Table;
using Bit.Core;
using Bit.Core.Utilities;
namespace Bit.Admin.Controllers
{
@ -62,6 +63,7 @@ namespace Bit.Admin.Controllers
return View(new UserViewModel(user, ciphers));
}
[SelfHosted(NotSelfHostedOnly = true)]
public async Task<IActionResult> Edit(Guid id)
{
var user = await _userRepository.GetByIdAsync(id);
@ -76,6 +78,7 @@ namespace Bit.Admin.Controllers
[HttpPost]
[ValidateAntiForgeryToken]
[SelfHosted(NotSelfHostedOnly = true)]
public async Task<IActionResult> Edit(Guid id, UserEditModel model)
{
var user = await _userRepository.GetByIdAsync(id);

View File

@ -3,9 +3,9 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Bit.Core.Repositories;
using Bit.Core.Models.Api;
using Bit.Api.Utilities;
using Microsoft.AspNetCore.Authorization;
using Bit.Core.Exceptions;
using Bit.Core.Utilities;
namespace Bit.Api.Controllers
{

View File

@ -3,11 +3,11 @@ using Bit.Core.Services;
using Microsoft.AspNetCore.Authorization;
using Bit.Core;
using System.Threading.Tasks;
using Bit.Api.Utilities;
using Bit.Core.Models.Business;
using Bit.Core.Exceptions;
using Bit.Core.Repositories;
using System;
using Bit.Core.Utilities;
namespace Bit.Api.Controllers
{

View File

@ -17,6 +17,7 @@ using jsreport.Types;
using Bit.Api.Models;
using Stripe;
using Microsoft.Extensions.Options;
using Bit.Core.Utilities;
namespace Bit.Api.Controllers
{

View File

@ -8,6 +8,7 @@ using System.Threading.Tasks;
using System.Linq;
using Microsoft.AspNetCore.Hosting;
using Bit.Api.Utilities;
using Bit.Core.Utilities;
namespace Bit.Api.Controllers
{

View File

@ -1,9 +1,8 @@
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.DependencyInjection;
using Bit.Core;
using Bit.Core.Exceptions;
namespace Bit.Api.Utilities
namespace Bit.Core.Utilities
{
public class SelfHostedAttribute : ActionFilterAttribute
{