mirror of
https://github.com/bitwarden/mobile
synced 2026-01-10 04:23:21 +00:00
Implemented Custom role and permissions (#1189)
* Implemented Custom role and permissions * changed permissions to permissions model * added a semicolon
This commit is contained in:
@@ -26,6 +26,7 @@ namespace Bit.Core.Models.Data
|
||||
Seats = response.Seats;
|
||||
MaxCollections = response.MaxCollections;
|
||||
MaxStorageGb = response.MaxStorageGb;
|
||||
Permissions = response.Permissions;
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
@@ -45,5 +46,6 @@ namespace Bit.Core.Models.Data
|
||||
public int Seats { get; set; }
|
||||
public int MaxCollections { get; set; }
|
||||
public short? MaxStorageGb { get; set; }
|
||||
public Permissions Permissions { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
16
src/Core/Models/Data/Permissions.cs
Normal file
16
src/Core/Models/Data/Permissions.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace Bit.Core.Models.Data
|
||||
{
|
||||
public class Permissions
|
||||
{
|
||||
public bool AccessBusinessPortal { get; set; }
|
||||
public bool AccessEventLogs { get; set; }
|
||||
public bool AccessImportExport { get; set; }
|
||||
public bool AccessReports { get; set; }
|
||||
public bool ManageAssignedCollections { get; set; }
|
||||
public bool ManageAllCollections { get; set; }
|
||||
public bool ManageGroups { get; set; }
|
||||
public bool ManagePolicies { get; set; }
|
||||
public bool ManageSso { get; set; }
|
||||
public bool ManageUsers { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@ namespace Bit.Core.Models.Domain
|
||||
Seats = obj.Seats;
|
||||
MaxCollections = obj.MaxCollections;
|
||||
MaxStorageGb = obj.MaxStorageGb;
|
||||
Permissions = obj.Permissions;
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
@@ -45,6 +46,7 @@ namespace Bit.Core.Models.Domain
|
||||
public int Seats { get; set; }
|
||||
public int MaxCollections { get; set; }
|
||||
public short? MaxStorageGb { get; set; }
|
||||
public Permissions Permissions { get; set; }
|
||||
|
||||
public bool CanAccess
|
||||
{
|
||||
@@ -76,5 +78,15 @@ namespace Bit.Core.Models.Domain
|
||||
|
||||
public bool IsAdmin => Type == OrganizationUserType.Owner || Type == OrganizationUserType.Admin;
|
||||
public bool IsOwner => Type == OrganizationUserType.Owner;
|
||||
public bool IsCustom => Type == OrganizationUserType.Custom;
|
||||
public bool canAccessBusinessPortl => IsAdmin || Permissions.AccessBusinessPortal;
|
||||
public bool canAccessEventLogs => IsAdmin || Permissions.AccessEventLogs;
|
||||
public bool canAccessImportExport => IsAdmin || Permissions.AccessImportExport;
|
||||
public bool canAccessReports => IsAdmin || Permissions.AccessReports;
|
||||
public bool canManageAllCollections => IsAdmin || Permissions.ManageAllCollections;
|
||||
public bool canManageAssignedCollections => IsManager || Permissions.ManageAssignedCollections;
|
||||
public bool canManageGroups => IsAdmin || Permissions.ManageGroups;
|
||||
public bool canManagePolicies => IsAdmin || Permissions.ManagePolicies;
|
||||
public bool canManageUser => IsAdmin || Permissions.ManageUsers;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Data;
|
||||
|
||||
namespace Bit.Core.Models.Response
|
||||
{
|
||||
@@ -22,5 +23,6 @@ namespace Bit.Core.Models.Response
|
||||
public OrganizationUserStatusType Status { get; set; }
|
||||
public OrganizationUserType Type { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
public Permissions Permissions { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user