Skip to content

[NEW] Privacy for custom user fields#10891

Closed
vynmera wants to merge 25 commits intoRocketChat:developfrom
vynmera:customfield-privacy
Closed

[NEW] Privacy for custom user fields#10891
vynmera wants to merge 25 commits intoRocketChat:developfrom
vynmera:customfield-privacy

Conversation

@vynmera
Copy link
Copy Markdown
Contributor

@vynmera vynmera commented May 27, 2018

View #11332 instead

Closes an undocumented UI issue where a user without permissions couldn't see their own fields in the user panel, but could see them in their profile.
Possibly related to #6515.

When using custom user fields, you might not want to expose rather private fields like statusConnection or their email. Currently, to view custom fields, the view-full-other-user-info permission is required.
This PR adds an optional public field to all Accounts_CustomFields entries, which overrides this requirement, so users without the permission can see the field.

Setup

2018-05-27_18-35-38
2018-05-27_18-35-46
The public field will default to false when not specified.

Preview

Any user can see all of their own fields.
2018-05-27_18-36-40
However, if they do not have the view-full-other-user-info permission, they can only see others' public fields.
2018-05-27_18-36-34
Of course, those with the view-full-other-user-info permission can always see all fields.
2018-05-27_18-36-19

This is my first OSS contribution, so please tell me how I did!

@RocketChat RocketChat deleted a comment May 27, 2018
@RocketChat RocketChat deleted a comment May 27, 2018
@RocketChat RocketChat deleted a comment May 27, 2018
@vynmera
Copy link
Copy Markdown
Contributor Author

vynmera commented May 27, 2018

I believe this should do it. If there are any issues, please let me know (as I'm new to this codebase)

sCustomFields = JSON.parse(metaCustomFields);

if (sCustomFields) {
_.each(sCustomFields, (el, key) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's change this to Object.keys(sCustomFields).forEach((key) => { const item = sCustomFields[key]; }), as we are slowly trying to lift our reliance on the _ package.

});
}
} catch (e) {
if (metaCustomFields !== '') {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Instead of checking this here, let's check it first before we try to parse the json. This way the error being thrown is a valid error instead of a error that will happen on the servers which don't use custom fields. As a server might have setup error handling/monitoring and adding a false positive will not be the best option, in my opinion. :)

@ggazzo ggazzo added this to the 0.67.0 milestone Jul 2, 2018
@ggazzo ggazzo added the area: ui/ux Related to UI/UX, frontend code, accessibility, and user interaction label Jul 2, 2018
@vynmera
Copy link
Copy Markdown
Contributor Author

vynmera commented Jul 4, 2018

I'm closing this PR as I've remade it here: #11332
This branch (and my Git setup) got very messy :)

@vynmera vynmera closed this Jul 4, 2018
@theorenck theorenck modified the milestones: 0.67.0, 0.68.0 Jul 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ui/ux Related to UI/UX, frontend code, accessibility, and user interaction

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants