distal-attribute
distal-attribute
distal-attribute
distal-attribute

Clone functionality in user manager

blauhut posted 3 years ago in General
When I clone a user in user manger (r3914, 5.0.15), I would expect to get a user with all the privileges copied from the currently selected user. What I get is a new user with no privileges, so there seems to be no difference to creating a new user.
Is my expectation wrong?
ansgar posted 3 years ago
Your expectation is right. And I think that was the case at some point, and I broke that in some recent change, accidentally. Will check.
ansgar posted 3 years ago
Fixed in r3917
alfiqmiq posted 7 months ago
In this case... can You also clone password string? MAny times I need to add acces for one user from different locations.
ansgar posted 7 months ago
The "IDENTIFIED BY 'yourpassword'" expects a clear text, non encrypted password. As the hashes are not reversible, it cannot be cloned. Sorry.

alfiqmiq posted 7 months ago
but when You clone user You can copy an encrypted password after user insert (db: mysql, table: user, column: Password) and then run flush privileges. As I think You can do that becouse I do that manually and works fine.

From that point is my suggestion to improve functionality of this function.
ansgar posted 7 months ago
Oh, you're right, you can pass both a plaintext password or a hash:

mysqldocs wrote: To avoid specifying the plaintext password if you know its hash value (the value that PASSWORD() would return for the password), specify the hash value preceded by the keyword PASSWORD:

CREATE USER 'jeffrey'@'localhost'
IDENTIFIED BY PASSWORD '*90E462C37378CED12064BB3388827D2BA3A9B689';

alfiqmiq posted 7 months ago
Sol can You add this functionality to clone user in user manager ?
alfiqmiq posted 7 months ago
I think that You can add sth like checkbox "hash/plain text" and depends on it create new account. This would be more universal solution.
ansgar posted 7 months ago
We don't even need a checkbox. Hashes begin with a '*' character and always have the same length of 41 characters. When cloning a user, I can just copy the hash to the new user's password, and disable the password char in the password edit boxes.

ansgar posted 7 months ago
r4747 overtakes the old username and hashed password when cloning a user.

Please login to leave a reply, or register at first.