Skip to content

CASL part 1 - #189

Open
tdresser wants to merge 7 commits into
mainfrom
casl
Open

tdresser wants to merge 7 commits into
mainfrom
casl

Conversation

@tdresser

Copy link
Copy Markdown
Collaborator

This implements CASL authorization, but doesn't use it, or integrate it at the db level.
The framework for using it with mikroORM is landed, but only used in a test showing off roughly how it works.

Followup patches will integrate this into our repository and baseentitiy classes, and ensure this is used by our services.

Comment thread grassroots-backend/src/auth/CASLIntegration.ts Outdated
phoneNumber!: string;

@ManyToOne(() => OrganizationEntity)
@ManyToOne(() => OrganizationEntity, { joinColumn: "organizationId" })

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We make sure the organizationId exists, and is the same name as the DTO property, so this can be used in CASL rules.

Comment thread grassroots-backend/src/grassroots-shared/Permission.ts Outdated
Comment thread grassroots-backend/src/grassroots-shared/Permission.ts
Comment thread grassroots-backend/src/organizations/Organizations.service.ts Outdated
},
});
return <div>{(users?.users ?? []).map((x) => UserRow({ user: x }))}</div>;
return <div>{users.users.map((x) => UserRow({ user: x }))}</div>;

@tdresser tdresser Aug 11, 2025 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix an eslint warning I didn't get when landing the search fix.

@tdresser
tdresser requested a review from IanEdington August 11, 2025 20:05
@tdresser

Copy link
Copy Markdown
Collaborator Author

This is ready for review!

Start here.

@tdresser
tdresser force-pushed the casl branch 6 times, most recently from d8bcbc2 to 728a2a9 Compare September 4, 2025 16:52
Base automatically changed from user_active_organization to main September 6, 2025 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant