It would be good to have the possibility to disallow users to access Key authentication and generate keys themself.
The key has to be generated by the administrator.

CommentFileSizeAuthor
#3 key_auth-permissions-3261708-3.patch2.66 KBkiseleva.t

Issue fork key_auth-3261708

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

kiseleva.t created an issue. See original summary.

kiseleva.t’s picture

Status: Needs work » Needs review
StatusFileSize
new2.66 KB
rajeshreeputra’s picture

@kiseleva.t, This make sense.
I'm keeping this in need review(for next couple of days), so we can get few more insights, then will incorporate these changes in next release.

leksat’s picture

I found this issue for a bit different reason. On my website there are users with administer users permission. Yet I don't want them to manage the auth keys.

Basically I need the following:

-      $access = AccessResult::allowedIfHasPermission($current_user, 'administer users');
+      $access = AccessResult::allowedIfHasPermissions($current_user, 'manage any auth keys']);

If this sounds like a good idea, we could add an update hook that adds the new manage any auth keys permission to all users having administer users.

solideogloria’s picture

Either is fine for me, but I would like a permission like this added.

solideogloria’s picture

Version: 2.0.x-dev » 2.1.0

We should target the latest branch.

(Also, could a maintainer add "2.1.x-dev" to the Version dropdown, please?)

rajeshreeputra’s picture

Created 2.1.x branch updated the same in MR, Thank You!!

reinimax’s picture

Thanks for the patch, this is a very useful feature indeed!

However, I'm wondering whether it is a good idea to let any user with the "administer users" permission view the key authentication tab? Sure, they cannot edit the authentication key without the appropriate permission, but they can still see and potentially disclose or abuse this information.

In my opinion, it would be better to remove the "administer users" permission from the access check in UserKeyAuthForm, so that access is only granted if the user has the appropriate permissions from the key_auth module. If a role who manages users needs to view the key authentication tab, they can simply be assigned an additional role.

super_romeo made their first commit to this issue’s fork.

super_romeo’s picture

I added branch "3261708-a-separate-permission-" (please rename it to "3261708-a-separate-permission-without-administer-users") same to "3261708-a-separate-permission". MR18.

nickdjm’s picture

What's holding this back from being merged in? If there's something more to be done I'd love to help push this through.

solideogloria’s picture

The issue is marked Needs Review. Please test and review the changes in MR !18.

You can download the code changes as a patch/diff, and include the downloaded file in your Composer patches file.

rajeshreeputra’s picture

Status: Needs review » Fixed

Merged in 2.x branch!!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.