Skip to content
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

feat: support for user linked project permissions #147

Merged
merged 5 commits into from
Jun 17, 2024

Conversation

tomwwinter
Copy link
Contributor

@tomwwinter tomwwinter requested a review from sleidig May 21, 2024 11:12
Copy link
Member

@sleidig sleidig left a comment

Choose a reason for hiding this comment

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

Looks good so far, but isn't this currently still missing the core of the logic, i.e. that the project field is used to filter out docs during replication?
Or can "projects" now somehow be used in configured rules?

Comment on lines +29 to +37
const user = await firstValueFrom(
this.couchdbService.get('app', data['username']),
).catch(() => {});

return new UserInfo(
data.username,
data['_couchdb.roles'],
user && user['projects'] ? user['projects'] : [],
);
Copy link
Member

Choose a reason for hiding this comment

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

small code block, but also for future proofing I would suggest we put the UserInfo creation in a service rather than duplicate it.

@sleidig
Copy link
Member

sleidig commented Jun 10, 2024

Looks good so far, but isn't this currently still missing the core of the logic, i.e. that the project field is used to filter out docs during replication? Or can "projects" now somehow be used in configured rules?

Okay, understood now that this simply works out of the box 😄
(placeholder is available as ${user.projects} for the permission config)

@tomwwinter tomwwinter requested a review from sleidig June 17, 2024 12:42
Copy link
Member

@sleidig sleidig left a comment

Choose a reason for hiding this comment

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

Looks good!

Could still remove that code duplication here #147 (comment)
but we can also do this once we touch that code again.

@tomwwinter tomwwinter merged commit 2c86424 into master Jun 17, 2024
4 of 6 checks passed
@tomwwinter tomwwinter deleted the tw/feat/i-21-roles-and-permissions branch June 17, 2024 13:42
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.

2 participants