1
0
mirror of https://github.com/bitwarden/server synced 2025-12-17 08:43:27 +00:00

api adjustments for manager role and collections

This commit is contained in:
Kyle Spearrin
2018-10-17 14:58:45 -04:00
parent ca175e7dd8
commit 7db36e0005
19 changed files with 426 additions and 82 deletions

View File

@@ -111,6 +111,16 @@ namespace Bit.Core
Type = OrganizationUserType.User
}));
}
if(claimsDict.ContainsKey("orgmanager"))
{
Organizations.AddRange(claimsDict["orgmanager"].Select(c =>
new CurrentContentOrganization
{
Id = new Guid(c.Value),
Type = OrganizationUserType.Manager
}));
}
}
public bool OrganizationUser(Guid orgId)
@@ -118,6 +128,13 @@ namespace Bit.Core
return Organizations?.Any(o => o.Id == orgId) ?? false;
}
public bool OrganizationManager(Guid orgId)
{
return Organizations?.Any(o => o.Id == orgId &&
(o.Type == OrganizationUserType.Owner || o.Type == OrganizationUserType.Admin ||
o.Type == OrganizationUserType.Manager)) ?? false;
}
public bool OrganizationAdmin(Guid orgId)
{
return Organizations?.Any(o => o.Id == orgId &&