mirror of
https://github.com/bitwarden/server.git
synced 2025-04-16 10:38:17 -05:00
set owner context for org api
This commit is contained in:
parent
4ec05e111c
commit
b39d1e13d7
@ -73,6 +73,7 @@ namespace Bit.Core
|
|||||||
|
|
||||||
var clientId = GetClaimValue(claimsDict, "client_id");
|
var clientId = GetClaimValue(claimsDict, "client_id");
|
||||||
var clientSubject = GetClaimValue(claimsDict, "client_sub");
|
var clientSubject = GetClaimValue(claimsDict, "client_sub");
|
||||||
|
var orgApi = false;
|
||||||
if(clientSubject != null)
|
if(clientSubject != null)
|
||||||
{
|
{
|
||||||
if(clientId?.StartsWith("installation.") ?? false)
|
if(clientId?.StartsWith("installation.") ?? false)
|
||||||
@ -87,6 +88,7 @@ namespace Bit.Core
|
|||||||
if(Guid.TryParse(clientSubject, out var idGuid))
|
if(Guid.TryParse(clientSubject, out var idGuid))
|
||||||
{
|
{
|
||||||
OrganizationId = idGuid;
|
OrganizationId = idGuid;
|
||||||
|
orgApi = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -103,6 +105,14 @@ namespace Bit.Core
|
|||||||
Type = OrganizationUserType.Owner
|
Type = OrganizationUserType.Owner
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
else if(orgApi && OrganizationId.HasValue)
|
||||||
|
{
|
||||||
|
Organizations.Add(new CurrentContentOrganization
|
||||||
|
{
|
||||||
|
Id = OrganizationId.Value,
|
||||||
|
Type = OrganizationUserType.Owner
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if(claimsDict.ContainsKey("orgadmin"))
|
if(claimsDict.ContainsKey("orgadmin"))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user