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

#1044 implement user column type #1045

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

florentinap
Copy link
Contributor

@florentinap florentinap commented Jun 13, 2024

This PR adds a new column type: User. It allows user to add a reference to another active user in organization. A list of available user names is displayed as suggestions.
image
image

This PR adds a new column type: User. It allows user to add a reference to another active user in organization. A list of available user names is displayed as suggestions.
Comment on lines +2407 to +2416
for (const user of res) {
const fullUser = this.makeFullUser(user);

if (![...NON_LOGIN_EMAILS, SUPPORT_EMAIL].includes(fullUser.email)) {
users.push({
...fullUser,
access: null
});
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

[comment that you may dismiss, I am a bit nitpicking]

In a more functional way, you may use Array#flatMap instead:

Suggested change
for (const user of res) {
const fullUser = this.makeFullUser(user);
if (![...NON_LOGIN_EMAILS, SUPPORT_EMAIL].includes(fullUser.email)) {
users.push({
...fullUser,
access: null
});
}
}
const users: UserAccessData[] = res.flatMap((user) => {
const fullUser = this.makeFullUser(user);
return [...NON_LOGIN_EMAILS, SUPPORT_EMAIL].includes(fullUser.email)) ? [] : [{
...fullUser,
access: null,
}];
});

const users = await this._dbManager.getUsers();

return sendReply(req, res, users);
}));
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if that would not be a security issue, considering that it would expose the list of every users of an instance (their name and their email), no matter what access to their information the requester have.

Copy link
Contributor Author

@florentinap florentinap Jun 14, 2024

Choose a reason for hiding this comment

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

In my use case, I control all users in the instance, so there is no problem. You know more use cases, so you know if there is one that listing all users might be a security issue. Do you think it would be better to list only users who have access to the current site?

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