mirror of
https://github.com/bitwarden/server
synced 2025-12-14 15:23:42 +00:00
limit edit functions to cloud hosted
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
Reference in New Issue
Block a user