mirror of
https://github.com/hcengineering/platform.git
synced 2026-08-17 18:05:42 +02:00
Fix admin integrations (#10076)
* Get your own integrations for admin Signed-off-by: Artem Savchenko <armisav@gmail.com> * Remove admin check Signed-off-by: Artem Savchenko <armisav@gmail.com> * Clean up Signed-off-by: Artem Savchenko <armisav@gmail.com> * Allow to add social id by admin Signed-off-by: Artem Savchenko <armisav@gmail.com> * Use service token for integrations test Signed-off-by: Artem Savchenko <armisav@gmail.com> * Update version Signed-off-by: Artem Savchenko <armisav@gmail.com> * Fix tokens Signed-off-by: Artem Savchenko <armisav@gmail.com> * Update allowed services Signed-off-by: Artem Savchenko <armisav@gmail.com> * Use workspace service Signed-off-by: Artem Savchenko <armisav@gmail.com> * Fix service client Signed-off-by: Artem Savchenko <armisav@gmail.com> * Get rid of admin service name Signed-off-by: Artem Savchenko <armisav@gmail.com> --------- Signed-off-by: Artem Savchenko <armisav@gmail.com>
This commit is contained in:
@@ -52,6 +52,7 @@
|
||||
"@hcengineering/core": "^0.7.7",
|
||||
"@hcengineering/client-resources": "^0.7.6",
|
||||
"@hcengineering/account": "^0.7.0",
|
||||
"@hcengineering/account-client": "^0.7.5"
|
||||
"@hcengineering/account-client": "^0.7.5",
|
||||
"@hcengineering/server-token": "^0.7.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { getClient as getClientRaw, type AccountClient } from '@hcengineering/account-client'
|
||||
import { LocalUrl, PlatformAdmin } from '../utils'
|
||||
import { systemAccountUuid } from '@hcengineering/core'
|
||||
import { generateToken } from '@hcengineering/server-token'
|
||||
|
||||
let adminAccountClient: AccountClient
|
||||
|
||||
@@ -18,3 +20,8 @@ export async function getAdminAccountClient (): Promise<AccountClient> {
|
||||
adminAccountClient = getClientRaw(LocalUrl, loginInfo.token)
|
||||
return adminAccountClient
|
||||
}
|
||||
|
||||
export async function getServiceAccountClient (serviceName: string): Promise<AccountClient> {
|
||||
const token = generateToken(systemAccountUuid, undefined, { service: serviceName }, 'secret')
|
||||
return getClientRaw(LocalUrl, token)
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@ import { Integration, IntegrationSecret } from '@hcengineering/account'
|
||||
import { buildSocialIdString, IntegrationKind, SocialIdType } from '@hcengineering/core'
|
||||
|
||||
import { PlatformUser } from './utils'
|
||||
import { getAdminAccountClient } from './API/AccountClient'
|
||||
import { getServiceAccountClient } from './API/AccountClient'
|
||||
|
||||
test.describe('integrations in accounts tests', () => {
|
||||
test('manage integrations', async () => {
|
||||
const accountClient = await getAdminAccountClient()
|
||||
const accountClient = await getServiceAccountClient('github')
|
||||
|
||||
const personUuid = await accountClient.findPersonBySocialKey(
|
||||
buildSocialIdString({ type: SocialIdType.EMAIL, value: PlatformUser })
|
||||
|
||||
Reference in New Issue
Block a user