Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Commit

Permalink
Add useKeyConnector flag (#551)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hinton committed Nov 17, 2021
1 parent 7209674 commit e1b1efe
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 10 deletions.
4 changes: 2 additions & 2 deletions common/src/models/api/ssoConfigApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ enum Saml2SigningBehavior {
export class SsoConfigApi extends BaseResponse {
configType: SsoType;

useKeyConnector: boolean;
keyConnectorEnabled: boolean;
keyConnectorUrl: string;

// OpenId
Expand Down Expand Up @@ -81,7 +81,7 @@ export class SsoConfigApi extends BaseResponse {

this.configType = this.getResponseProperty('ConfigType');

this.useKeyConnector = this.getResponseProperty('UseKeyConnector');
this.keyConnectorEnabled = this.getResponseProperty('KeyConnectorEnabled');
this.keyConnectorUrl = this.getResponseProperty('KeyConnectorUrl');

this.authority = this.getResponseProperty('Authority');
Expand Down
6 changes: 4 additions & 2 deletions common/src/models/data/organizationData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export class OrganizationData {
use2fa: boolean;
useApi: boolean;
useSso: boolean;
useKeyConnector: boolean;
useResetPassword: boolean;
selfHost: boolean;
usersGetPremium: boolean;
Expand All @@ -33,7 +34,7 @@ export class OrganizationData {
providerId: string;
providerName: string;
isProviderUser: boolean;
usesKeyConnector: boolean;
keyConnectorEnabled: boolean;
keyConnectorUrl: string;

constructor(response: ProfileOrganizationResponse) {
Expand All @@ -50,6 +51,7 @@ export class OrganizationData {
this.use2fa = response.use2fa;
this.useApi = response.useApi;
this.useSso = response.useSso;
this.useKeyConnector = response.useKeyConnector;
this.useResetPassword = response.useResetPassword;
this.selfHost = response.selfHost;
this.usersGetPremium = response.usersGetPremium;
Expand All @@ -64,7 +66,7 @@ export class OrganizationData {
this.hasPublicAndPrivateKeys = response.hasPublicAndPrivateKeys;
this.providerId = response.providerId;
this.providerName = response.providerName;
this.usesKeyConnector = response.usesKeyConnector;
this.keyConnectorEnabled = response.keyConnectorEnabled;
this.keyConnectorUrl = response.keyConnectorUrl;
}
}
6 changes: 4 additions & 2 deletions common/src/models/domain/organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export class Organization {
use2fa: boolean;
useApi: boolean;
useSso: boolean;
useKeyConnector: boolean;
useResetPassword: boolean;
selfHost: boolean;
usersGetPremium: boolean;
Expand All @@ -34,7 +35,7 @@ export class Organization {
providerId: string;
providerName: string;
isProviderUser: boolean;
usesKeyConnector: boolean;
keyConnectorEnabled: boolean;
keyConnectorUrl: string;

constructor(obj?: OrganizationData) {
Expand All @@ -55,6 +56,7 @@ export class Organization {
this.use2fa = obj.use2fa;
this.useApi = obj.useApi;
this.useSso = obj.useSso;
this.useKeyConnector = obj.useKeyConnector;
this.useResetPassword = obj.useResetPassword;
this.selfHost = obj.selfHost;
this.usersGetPremium = obj.usersGetPremium;
Expand All @@ -70,7 +72,7 @@ export class Organization {
this.providerId = obj.providerId;
this.providerName = obj.providerName;
this.isProviderUser = obj.isProviderUser;
this.usesKeyConnector = obj.usesKeyConnector;
this.keyConnectorEnabled = obj.keyConnectorEnabled;
this.keyConnectorUrl = obj.keyConnectorUrl;
}

Expand Down
6 changes: 4 additions & 2 deletions common/src/models/response/profileOrganizationResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export class ProfileOrganizationResponse extends BaseResponse {
use2fa: boolean;
useApi: boolean;
useSso: boolean;
useKeyConnector: boolean;
useResetPassword: boolean;
selfHost: boolean;
usersGetPremium: boolean;
Expand All @@ -33,7 +34,7 @@ export class ProfileOrganizationResponse extends BaseResponse {
userId: string;
providerId: string;
providerName: string;
usesKeyConnector: boolean;
keyConnectorEnabled: boolean;
keyConnectorUrl: string;

constructor(response: any) {
Expand All @@ -48,6 +49,7 @@ export class ProfileOrganizationResponse extends BaseResponse {
this.use2fa = this.getResponseProperty('Use2fa');
this.useApi = this.getResponseProperty('UseApi');
this.useSso = this.getResponseProperty('UseSso');
this.useKeyConnector = this.getResponseProperty('UseKeyConnector') ?? false;
this.useResetPassword = this.getResponseProperty('UseResetPassword');
this.selfHost = this.getResponseProperty('SelfHost');
this.usersGetPremium = this.getResponseProperty('UsersGetPremium');
Expand All @@ -66,7 +68,7 @@ export class ProfileOrganizationResponse extends BaseResponse {
this.userId = this.getResponseProperty('UserId');
this.providerId = this.getResponseProperty('ProviderId');
this.providerName = this.getResponseProperty('ProviderName');
this.usesKeyConnector = this.getResponseProperty('UsesKeyConnector') ?? false;
this.keyConnectorEnabled = this.getResponseProperty('KeyConnectorEnabled') ?? false;
this.keyConnectorUrl = this.getResponseProperty('KeyConnectorUrl');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { ProfileOrganizationResponse } from './profileOrganizationResponse';
export class ProfileProviderOrganizationResponse extends ProfileOrganizationResponse {
constructor(response: any) {
super(response);
this.usesKeyConnector = false;
this.keyConnectorEnabled = false;
}
}
2 changes: 1 addition & 1 deletion common/src/services/keyConnector.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class KeyConnectorService implements KeyConnectorServiceAbstraction {
async getManagingOrganization() {
const orgs = await this.userService.getAllOrganizations();
return orgs.find(o =>
o.usesKeyConnector &&
o.keyConnectorEnabled &&
o.type !== OrganizationUserType.Admin &&
o.type !== OrganizationUserType.Owner &&
!o.isProviderUser);
Expand Down

0 comments on commit e1b1efe

Please sign in to comment.