Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions app/controllers/api/v1/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,13 @@ def valid_domain?
end

def permitted_params
is_admin = PermissionsChecker.new(current_user:, permission_names: 'ManageUsers', current_provider:).call
is_user_manager = PermissionsChecker.new(current_user:, permission_names: 'ManageUsers', current_provider:).call

return %i[password avatar language role_id invite_token] if external_auth? && !is_admin
permitted = %i[password avatar language role_id invite_token]
permitted.push(:name) if is_user_manager || !external_auth?
permitted.push(:email) if is_user_manager
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Allowing the admin to change an external users email might be problematic - especially if things aren't configured correctly

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'd argue that this should be a local user thing but I imagine that's not what most people would need this for

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Allowing the admin to change an external users email might be problematic - especially if things aren't configured correctly

It depends a bit if email is the identifying key (or if the email fallback is activated). Anyway, if you feel like it is warranted, I can add a note in the documentation.


%i[name password avatar language role_id invite_token]
permitted
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default function UpdateUserForm({ user }) {
return (
<Form methods={methods} onSubmit={updateUserAPI.mutate}>
<FormControl field={fields.name} type="text" readOnly={user.external_account && !PermissionChecker.hasManageUsers(currentUser)} />
<FormControl field={fields.email} type="email" readOnly />
<FormControl field={fields.email} type="email" readOnly={!PermissionChecker.hasManageUsers(currentUser)} />
<FormSelect field={fields.language} variant="dropdown">
{
Object.keys(locales || {}).map((code) => <Option key={code} value={code}>{locales[code]}</Option>)
Expand Down
Loading