-
Notifications
You must be signed in to change notification settings - Fork 3.1k
[permissions] Add permissions check layer in entityManager #11818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
3c9a836
1d2b648
a327c23
c33a6d0
981a4cb
008d320
4d639be
6928956
180d047
c722d22
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import { EntityManager } from 'typeorm'; | ||
|
||
import { DEV_SEED_WORKSPACE_MEMBER_IDS } from 'src/database/typeorm-seeds/workspace/workspace-members'; | ||
import { WorkspaceEntityManager } from 'src/engine/twenty-orm/entity-manager/entity.manager'; | ||
|
||
const tableName = 'connectedAccount'; | ||
|
||
|
@@ -11,11 +10,13 @@ export const DEV_SEED_CONNECTED_ACCOUNT_IDS = { | |
}; | ||
|
||
export const seedConnectedAccount = async ( | ||
entityManager: EntityManager, | ||
entityManager: WorkspaceEntityManager, | ||
schemaName: string, | ||
) => { | ||
await entityManager | ||
.createQueryBuilder() | ||
.createQueryBuilder(undefined, undefined, undefined, { | ||
shouldBypassPermissionChecks: true, | ||
}) | ||
.insert() | ||
Comment on lines
+17
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: createQueryBuilder parameters are undefined but used in options object - consider documenting why these parameters are undefined or remove them if not needed |
||
.into(`${schemaName}.${tableName}`, [ | ||
'id', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import { EntityManager } from 'typeorm'; | ||
|
||
import { DEV_SEED_CONNECTED_ACCOUNT_IDS } from 'src/database/typeorm-seeds/workspace/connected-account'; | ||
import { WorkspaceEntityManager } from 'src/engine/twenty-orm/entity-manager/entity.manager'; | ||
import { | ||
MessageChannelSyncStage, | ||
MessageChannelVisibility, | ||
|
@@ -15,11 +14,13 @@ export const DEV_SEED_MESSAGE_CHANNEL_IDS = { | |
}; | ||
|
||
export const seedMessageChannel = async ( | ||
entityManager: EntityManager, | ||
entityManager: WorkspaceEntityManager, | ||
schemaName: string, | ||
) => { | ||
await entityManager | ||
.createQueryBuilder() | ||
.createQueryBuilder(undefined, undefined, undefined, { | ||
shouldBypassPermissionChecks: true, | ||
}) | ||
.insert() | ||
Comment on lines
+21
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: createQueryBuilder parameters are undefined but options are provided - consider documenting why these parameters are undefined or remove them if not needed |
||
.into(`${schemaName}.${tableName}`, [ | ||
'id', | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks a bit ugly but needed if we want to override EntityManager's createQueryBuilder, + is just in the seeds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be an object as an input to avoid that