wingrunr21 / gitolite

A Ruby interface for the gitolite git backend system
https://github.com/wingrunr21/gitolite
MIT License
82 stars 37 forks source link

Added ability to cleanup keys in permissions when deleting keys #36

Closed apfohl closed 11 years ago

apfohl commented 11 years ago

I need this feature, because I don't want to rebuild all permissions of all repositories when I remove only one ssh key.

wingrunr21 commented 11 years ago

I will consider it. This has other ramifications, however. If keys and permissions are going to be directly related in this way, then when adding a permission then the appropriate key should also exist. The object tree is not really designed to support this kind of interaction (it is planned for v2).

Also, a relatively inexpensive call is now considerably more expensive to make.

Finally, need a test.

apfohl commented 11 years ago

Yes, i see what you mean. But at the moment there is no other way to remove users from permissions. With the actual program structure you can only remove a user by rebuilding all permissions. This is expensive.

To proof that a user exists when creating a new permission is impossible. You can't access the ssh_keys hash from the repository class.

I agree with you that it's not reasonable to add this functionality right now. But if you want, I will create some tests for my extension.

wingrunr21 commented 11 years ago

If you want to add a test that could be helpful when this type of functionality is added in v2 of the gem.

Also, correct me if I'm wrong (I haven't had the chance to pull your code), but your patch will remove a given user's permissions across all repos, even if that user still has a key in the system (users can have multiple keys).

apfohl commented 11 years ago

Yes, you are right. I did not realize the ability that a user can have more than one key. I thought a key is a user. My fault.

My code is useless. Sorry for any inconvenience.