2021-10-05 11:12:05 -05:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
2022-01-21 09:36:25 -05:00
|
|
|
|
using System.Text.Json.Serialization;
|
2021-10-05 11:12:05 -05:00
|
|
|
|
|
2021-01-12 11:02:39 -05:00
|
|
|
|
namespace Bit.Core.Models.Data
|
|
|
|
|
|
{
|
|
|
|
|
|
public class Permissions
|
|
|
|
|
|
{
|
|
|
|
|
|
public bool AccessEventLogs { get; set; }
|
|
|
|
|
|
public bool AccessImportExport { get; set; }
|
|
|
|
|
|
public bool AccessReports { get; set; }
|
2021-10-05 11:12:05 -05:00
|
|
|
|
[Obsolete("This permission exists for client backwards-compatibility. It should not be used to determine permissions in this repository", true)]
|
|
|
|
|
|
public bool ManageAllCollections => CreateNewCollections && EditAnyCollection && DeleteAnyCollection;
|
|
|
|
|
|
public bool CreateNewCollections { get; set; }
|
|
|
|
|
|
public bool EditAnyCollection { get; set; }
|
|
|
|
|
|
public bool DeleteAnyCollection { get; set; }
|
|
|
|
|
|
[Obsolete("This permission exists for client backwards-compatibility. It should not be used to determine permissions in this repository", true)]
|
|
|
|
|
|
public bool ManageAssignedCollections => EditAssignedCollections && DeleteAssignedCollections;
|
|
|
|
|
|
public bool EditAssignedCollections { get; set; }
|
|
|
|
|
|
public bool DeleteAssignedCollections { get; set; }
|
2021-01-12 11:02:39 -05:00
|
|
|
|
public bool ManageGroups { get; set; }
|
|
|
|
|
|
public bool ManagePolicies { get; set; }
|
|
|
|
|
|
public bool ManageSso { get; set; }
|
|
|
|
|
|
public bool ManageUsers { get; set; }
|
2021-04-05 09:45:17 -05:00
|
|
|
|
public bool ManageResetPassword { get; set; }
|
2021-10-05 11:12:05 -05:00
|
|
|
|
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public List<(bool Permission, string ClaimName)> ClaimsMap => new()
|
|
|
|
|
|
{
|
|
|
|
|
|
(AccessEventLogs, "accesseventlogs"),
|
|
|
|
|
|
(AccessImportExport, "accessimportexport"),
|
|
|
|
|
|
(AccessReports, "accessreports"),
|
|
|
|
|
|
(CreateNewCollections, "createnewcollections"),
|
|
|
|
|
|
(EditAnyCollection, "editanycollection"),
|
|
|
|
|
|
(DeleteAnyCollection, "deleteanycollection"),
|
|
|
|
|
|
(EditAssignedCollections, "editassignedcollections"),
|
|
|
|
|
|
(DeleteAssignedCollections, "deleteassignedcollections"),
|
|
|
|
|
|
(ManageGroups, "managegroups"),
|
|
|
|
|
|
(ManagePolicies, "managepolicies"),
|
|
|
|
|
|
(ManageSso, "managesso"),
|
|
|
|
|
|
(ManageUsers, "manageusers"),
|
|
|
|
|
|
(ManageResetPassword, "manageresetpassword"),
|
|
|
|
|
|
};
|
2021-01-12 11:02:39 -05:00
|
|
|
|
}
|
|
|
|
|
|
}
|