fix: Pass app config parameters to be used for hooks
This commit is contained in:
@@ -66,6 +66,8 @@ class AppAuthClient extends Base {
|
|||||||
// This is a workaround to update connection allowed column for AppConfig
|
// This is a workaround to update connection allowed column for AppConfig
|
||||||
await appConfig?.$query().patch({
|
await appConfig?.$query().patch({
|
||||||
key: appConfig.key,
|
key: appConfig.key,
|
||||||
|
shared: appConfig.shared,
|
||||||
|
disabled: appConfig.disabled,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -47,21 +47,15 @@ class AppConfig extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async computeConnectionAllowedProperty() {
|
async computeConnectionAllowedProperty() {
|
||||||
const refetchedRecord = await AppConfig.query().findOne({ key: this.key });
|
const appAuthClients = await this.$relatedQuery('appAuthClients');
|
||||||
|
|
||||||
if (!refetchedRecord) return;
|
|
||||||
|
|
||||||
const appAuthClients = await refetchedRecord.$relatedQuery(
|
|
||||||
'appAuthClients'
|
|
||||||
);
|
|
||||||
|
|
||||||
const hasSomeActiveAppAuthClients =
|
const hasSomeActiveAppAuthClients =
|
||||||
appAuthClients?.some((appAuthClient) => appAuthClient.active) || false;
|
appAuthClients?.some((appAuthClient) => appAuthClient.active) || false;
|
||||||
|
|
||||||
const conditions = [
|
const conditions = [
|
||||||
hasSomeActiveAppAuthClients,
|
hasSomeActiveAppAuthClients,
|
||||||
refetchedRecord.shared,
|
this.shared,
|
||||||
!refetchedRecord.disabled,
|
!this.disabled,
|
||||||
];
|
];
|
||||||
|
|
||||||
const connectionAllowed = conditions.every(Boolean);
|
const connectionAllowed = conditions.every(Boolean);
|
||||||
|
Reference in New Issue
Block a user