mirror of
https://github.com/bitwarden/server.git
synced 2025-04-05 05:00:19 -05:00
[PM-17697] Save Organization Name changes in Bitwarden Portal (#5337)
* Add Org_Name_Edit permission to the Permissions enum * Add Org_Name_Edit permission to RolePermissionMapping * Implement Org_Name_Edit permission check in UpdateOrganization method * Add Org_Name_Edit permission check to Organization form input
This commit is contained in:
parent
148a631178
commit
d239170c1c
@ -421,6 +421,11 @@ public class OrganizationsController : Controller
|
|||||||
|
|
||||||
private void UpdateOrganization(Organization organization, OrganizationEditModel model)
|
private void UpdateOrganization(Organization organization, OrganizationEditModel model)
|
||||||
{
|
{
|
||||||
|
if (_accessControlService.UserHasPermission(Permission.Org_Name_Edit))
|
||||||
|
{
|
||||||
|
organization.Name = WebUtility.HtmlEncode(model.Name);
|
||||||
|
}
|
||||||
|
|
||||||
if (_accessControlService.UserHasPermission(Permission.Org_CheckEnabledBox))
|
if (_accessControlService.UserHasPermission(Permission.Org_CheckEnabledBox))
|
||||||
{
|
{
|
||||||
organization.Enabled = model.Enabled;
|
organization.Enabled = model.Enabled;
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
var canViewBilling = AccessControlService.UserHasPermission(Permission.Org_Billing_View);
|
var canViewBilling = AccessControlService.UserHasPermission(Permission.Org_Billing_View);
|
||||||
var canViewPlan = AccessControlService.UserHasPermission(Permission.Org_Plan_View);
|
var canViewPlan = AccessControlService.UserHasPermission(Permission.Org_Plan_View);
|
||||||
var canViewLicensing = AccessControlService.UserHasPermission(Permission.Org_Licensing_View);
|
var canViewLicensing = AccessControlService.UserHasPermission(Permission.Org_Licensing_View);
|
||||||
|
var canEditName = AccessControlService.UserHasPermission(Permission.Org_Name_Edit);
|
||||||
var canCheckEnabled = AccessControlService.UserHasPermission(Permission.Org_CheckEnabledBox);
|
var canCheckEnabled = AccessControlService.UserHasPermission(Permission.Org_CheckEnabledBox);
|
||||||
var canEditPlan = AccessControlService.UserHasPermission(Permission.Org_Plan_Edit);
|
var canEditPlan = AccessControlService.UserHasPermission(Permission.Org_Plan_Edit);
|
||||||
var canEditLicensing = AccessControlService.UserHasPermission(Permission.Org_Licensing_Edit);
|
var canEditLicensing = AccessControlService.UserHasPermission(Permission.Org_Licensing_Edit);
|
||||||
@ -28,7 +29,7 @@
|
|||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" asp-for="Name"></label>
|
<label class="form-label" asp-for="Name"></label>
|
||||||
<input type="text" class="form-control" asp-for="Name" value="@Model.Name" required>
|
<input type="text" class="form-control" asp-for="Name" value="@Model.Name" required disabled="@(canEditName ? null : "disabled")">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -22,6 +22,7 @@ public enum Permission
|
|||||||
Org_List_View,
|
Org_List_View,
|
||||||
Org_OrgInformation_View,
|
Org_OrgInformation_View,
|
||||||
Org_GeneralDetails_View,
|
Org_GeneralDetails_View,
|
||||||
|
Org_Name_Edit,
|
||||||
Org_CheckEnabledBox,
|
Org_CheckEnabledBox,
|
||||||
Org_BusinessInformation_View,
|
Org_BusinessInformation_View,
|
||||||
Org_InitiateTrial,
|
Org_InitiateTrial,
|
||||||
|
@ -24,6 +24,7 @@ public static class RolePermissionMapping
|
|||||||
Permission.User_Billing_Edit,
|
Permission.User_Billing_Edit,
|
||||||
Permission.User_Billing_LaunchGateway,
|
Permission.User_Billing_LaunchGateway,
|
||||||
Permission.User_NewDeviceException_Edit,
|
Permission.User_NewDeviceException_Edit,
|
||||||
|
Permission.Org_Name_Edit,
|
||||||
Permission.Org_CheckEnabledBox,
|
Permission.Org_CheckEnabledBox,
|
||||||
Permission.Org_List_View,
|
Permission.Org_List_View,
|
||||||
Permission.Org_OrgInformation_View,
|
Permission.Org_OrgInformation_View,
|
||||||
@ -71,6 +72,7 @@ public static class RolePermissionMapping
|
|||||||
Permission.User_Billing_Edit,
|
Permission.User_Billing_Edit,
|
||||||
Permission.User_Billing_LaunchGateway,
|
Permission.User_Billing_LaunchGateway,
|
||||||
Permission.User_NewDeviceException_Edit,
|
Permission.User_NewDeviceException_Edit,
|
||||||
|
Permission.Org_Name_Edit,
|
||||||
Permission.Org_CheckEnabledBox,
|
Permission.Org_CheckEnabledBox,
|
||||||
Permission.Org_List_View,
|
Permission.Org_List_View,
|
||||||
Permission.Org_OrgInformation_View,
|
Permission.Org_OrgInformation_View,
|
||||||
@ -116,6 +118,7 @@ public static class RolePermissionMapping
|
|||||||
Permission.User_Billing_View,
|
Permission.User_Billing_View,
|
||||||
Permission.User_Billing_LaunchGateway,
|
Permission.User_Billing_LaunchGateway,
|
||||||
Permission.User_NewDeviceException_Edit,
|
Permission.User_NewDeviceException_Edit,
|
||||||
|
Permission.Org_Name_Edit,
|
||||||
Permission.Org_CheckEnabledBox,
|
Permission.Org_CheckEnabledBox,
|
||||||
Permission.Org_List_View,
|
Permission.Org_List_View,
|
||||||
Permission.Org_OrgInformation_View,
|
Permission.Org_OrgInformation_View,
|
||||||
@ -148,6 +151,7 @@ public static class RolePermissionMapping
|
|||||||
Permission.User_Billing_View,
|
Permission.User_Billing_View,
|
||||||
Permission.User_Billing_Edit,
|
Permission.User_Billing_Edit,
|
||||||
Permission.User_Billing_LaunchGateway,
|
Permission.User_Billing_LaunchGateway,
|
||||||
|
Permission.Org_Name_Edit,
|
||||||
Permission.Org_CheckEnabledBox,
|
Permission.Org_CheckEnabledBox,
|
||||||
Permission.Org_List_View,
|
Permission.Org_List_View,
|
||||||
Permission.Org_OrgInformation_View,
|
Permission.Org_OrgInformation_View,
|
||||||
@ -185,6 +189,7 @@ public static class RolePermissionMapping
|
|||||||
Permission.User_Premium_View,
|
Permission.User_Premium_View,
|
||||||
Permission.User_Licensing_View,
|
Permission.User_Licensing_View,
|
||||||
Permission.User_Licensing_Edit,
|
Permission.User_Licensing_Edit,
|
||||||
|
Permission.Org_Name_Edit,
|
||||||
Permission.Org_CheckEnabledBox,
|
Permission.Org_CheckEnabledBox,
|
||||||
Permission.Org_List_View,
|
Permission.Org_List_View,
|
||||||
Permission.Org_OrgInformation_View,
|
Permission.Org_OrgInformation_View,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user