SnailyCAD / snaily-cadv4

💻 An open source Computer Aided Dispatch (CAD) for FiveM, this is a web based integration for communities who love police roleplaying and dispatching. Discord: https://discord.gg/eGnrPqEH7U
https://docs.snailycad.org/docs/getting-started
MIT License
137 stars 83 forks source link

Unable To Delete Bleet #1928

Closed MarshyMelloow closed 1 month ago

MarshyMelloow commented 2 months ago

What version of Node.js are you using?

18.20.2

What operating system are you using?

Ubuntu 22.04

What version of SnailyCAD are you currently using?

1.79.1

Describe the Bug

Users can not delete there bleet posts unless they have the View Users permission. There is also no Bleet permissions under the ​ user manage permissions tab. image

SnailyCAD Console:

[1] [2024-05-12T13:11:26.340] [ERROR] [SnailyCAD] - {
[1]   method: 'DELETE',
[1]   url: '/v1/bleeter/568eb624-cb5b-4bff-be00-0573d57c7a36',
[1]   route: '/v1/bleeter/:id',
[1]   headers: {
[1]     host: '166.0.233.116:8080',
[1]     connection: 'keep-alive',
[1]     accept: 'application/json, text/plain, */*',
[1]     'is-from-dispatch': 'false',
[1]     'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36',
[1]     session: '',
[1]     origin: 'http://166.0.233.116:3000',
[1]     referer: 'http://166.0.233.116:3000/',
[1]     'accept-encoding': 'gzip, deflate',
[1]     'accept-language': 'en-US,en;q=0.9',
[1]     cookie: 'snaily-cad-session=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjbHczdXA5engwMDM4MTNyNTZqdmM2bnppIiwiaWF0IjoxNzE1NTM3NDQ3LCJleHAiOjE3MTU1NDEwNDd9.bmJwQ-4OVN_lJp_7dirItjf-mWB8smb1MgHV0dzKU6E; snaily-cad-refresh-token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZXNzaW9uSWQiOiJveDN6bWgwamlpb2U4NGR1YTBtMWNhd2oiLCJpYXQiOjE3MTU1Mzc0NDcsImV4cCI6MTcxNjE0MjI0N30.rB9xKTIJh9b6zp7mk2BMjuliWuh8IgxltvGRzrKA2ds; sn_isDarkTheme=true'
[1]   },
[1]   body: {},
[1]   query: {},
[1]   params: {},
[1]   reqId: '54eca96db5174319ab629def8b5001d5',
[1]   time: 2024-05-12T18:11:26.340Z,
[1]   duration: 28,
[1]   event: 'request.end',
[1]   status: 403,
[1]   status_code: '403',
[1]   state: 'KO',
[1]   error_name: 'FORBIDDEN',
[1]   error_message: 'notAllowedToDelete',
[1]   error_stack: 'FORBIDDEN: notAllowedToDelete\n' +
[1]     '    at new Exception (/root/snaily-cadv4/node_modules/.pnpm/@tsed+exceptions@7.48.0_@tsed+core@7.48.0/node_modules/@tsed/exceptions/lib/cjs/core/Exception.js:55:15)\n' +
[1]     '    at new ClientException (/root/snaily-cadv4/node_modules/.pnpm/@tsed+exceptions@7.48.0_@tsed+core@7.48.0/node_modules/@tsed/exceptions/lib/cjs/core/ClientException.js:8:9)\n' +
[1]     '    at new Forbidden (/root/snaily-cadv4/node_modules/.pnpm/@tsed+exceptions@7.48.0_@tsed+core@7.48.0/node_modules/@tsed/exceptions/lib/cjs/clientErrors/Forbidden.js:8:9)\n' +
[1]     '    at BleeterController.deleteBleetPost (/root/snaily-cadv4/apps/api/dist/controllers/bleeter/bleeter-controller.js:203:19)',
[1]   error_headers: {}
[1] }

Expected Behavior

There should be permission options for users to delete bleets.

To Reproduce

Spin up a fresh install of SnailyCAD, and try to make and delete a bleets with a user that does not have admin permissions.

moulouds commented 1 month ago

Good morning,

News about the bug .

MarshyMelloow commented 1 month ago

For now to delete bleets you will need to have admin permissions, we will look into add this as a dedicated permission.

AshleyyRodriguez commented 1 month ago

Issue fixed in PR #1933