diff --git a/apps/meteor/ee/server/api/abac/index.ts b/apps/meteor/ee/server/api/abac/index.ts index 40e5f1336252a..01ec14f780f16 100644 --- a/apps/meteor/ee/server/api/abac/index.ts +++ b/apps/meteor/ee/server/api/abac/index.ts @@ -158,16 +158,11 @@ const abacEndpoints = API.v1 400: GenericErrorSchema, 403: validateUnauthorizedErrorResponse, }, - license: ['abac'], }, async function action() { const { offset, count } = await getPaginationItems(this.queryParams as Record); const { key, values } = this.queryParams; - if (!settings.get('ABAC_Enabled')) { - throw new Error('error-abac-not-enabled'); - } - return API.v1.success( await Abac.listAbacAttributes({ key, @@ -239,13 +234,10 @@ const abacEndpoints = API.v1 400: GenericErrorSchema, 403: validateUnauthorizedErrorResponse, }, - license: ['abac'], }, async function action() { const { _id } = this.urlParams; - if (!settings.get('ABAC_Enabled')) { - throw new Error('error-abac-not-enabled'); - } + const result = await Abac.getAbacAttributeById(_id); return API.v1.success(result); }, @@ -262,13 +254,10 @@ const abacEndpoints = API.v1 400: GenericErrorSchema, 403: validateUnauthorizedErrorResponse, }, - license: ['abac'], }, async function action() { const { _id } = this.urlParams; - if (!settings.get('ABAC_Enabled')) { - throw new Error('error-abac-not-enabled'); - } + await Abac.deleteAbacAttributeById(_id); return API.v1.success(); }, @@ -285,13 +274,10 @@ const abacEndpoints = API.v1 400: GenericErrorSchema, 403: validateUnauthorizedErrorResponse, }, - license: ['abac'], }, async function action() { const { key } = this.urlParams; - if (!settings.get('ABAC_Enabled')) { - throw new Error('error-abac-not-enabled'); - } + const inUse = await Abac.isAbacAttributeInUseByKey(key); return API.v1.success({ inUse }); }, diff --git a/apps/meteor/tests/end-to-end/api/abac.ts b/apps/meteor/tests/end-to-end/api/abac.ts index 5a8b9b25371c4..243141bd56fac 100644 --- a/apps/meteor/tests/end-to-end/api/abac.ts +++ b/apps/meteor/tests/end-to-end/api/abac.ts @@ -990,26 +990,6 @@ const addAbacAttributesToUserDirectly = async (userId: string, abacAttributes: I }); }); - it('GET /abac/attributes should fail while disabled', async () => { - await request - .get(`${v1}/abac/attributes`) - .set(credentials) - .expect(400) - .expect((res) => { - expect(res.body.error).to.include('error-abac-not-enabled'); - }); - }); - - it('GET /abac/attributes/:_id should fail while disabled', async () => { - await request - .get(`${v1}/abac/attributes/${secondAttributeId}`) - .set(credentials) - .expect(400) - .expect((res) => { - expect(res.body.error).to.include('error-abac-not-enabled'); - }); - }); - it('PUT /abac/attributes/:_id should fail while disabled', async () => { await request .put(`${v1}/abac/attributes/${secondAttributeId}`) @@ -1021,26 +1001,6 @@ const addAbacAttributesToUserDirectly = async (userId: string, abacAttributes: I }); }); - it('DELETE /abac/attributes/:_id should fail while disabled', async () => { - await request - .delete(`${v1}/abac/attributes/${secondAttributeId}`) - .set(credentials) - .expect(400) - .expect((res) => { - expect(res.body.error).to.include('error-abac-not-enabled'); - }); - }); - - it('GET /abac/attributes/:key/is-in-use should fail while disabled', async () => { - await request - .get(`${v1}/abac/attributes/${secondKey}/is-in-use`) - .set(credentials) - .expect(400) - .expect((res) => { - expect(res.body.error).to.include('error-abac-not-enabled'); - }); - }); - it('POST /abac/rooms/:rid/attributes/:key should fail while disabled', async () => { await request .post(`${v1}/abac/rooms/${testRoom._id}/attributes/${secondKey}`)