-
Notifications
You must be signed in to change notification settings - Fork 55
Support read-only access to repositories #159
Conversation
Oh... I forgot the docs! 😯 Hold on... 😀 |
181bf66
to
6136ae7
Compare
Done! 👍 |
6136ae7
to
3c1575f
Compare
if err := repository.GrantAccess(repositories, users); err != nil { | ||
http.Error(w, err.Error(), http.StatusNotFound) | ||
return | ||
if readonly == "yes" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the repository
package should encapulate the readonly
logic and the api should repass if the grant is full or readonly:
readonly := r.URL.Query().Get("readonly") == "true"
repository.GrantAccess(repositories, users, readonly)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about that too but decided to go exactly the opposite way: the repository
being agnostic as per:
“I'm a repository. Concerning my users, I just manage two collections,
Users
andReadOnlyUsers
, with read/write and read-only accesses respectively. These are the methods to operate on each of them, separately:GrantAccess
,RevokeAccess
,GrantReadOnlyAccess
andRevokeReadOnlyAccess
”.
3c1575f
to
d49018c
Compare
I've just rebased the changes on top of master until we decide the best way to implement this 😉 |
Regarding the repository.Repository struct: * `Repository.Users`: users that with write access * `Repository.ReadOnlyUsers`: users with read-only access Implementation notes: * When creating a new repository specify which users should be allowed read access * Allow specifying if read-only access when adding user to repo * When removing user from repo, remove from both write and read collections of users
d49018c
to
f0decf6
Compare
@fsouza wrote:
Two requests are necessary to achieve this:
|
Support read-only access to repositories
@scorphus thank you! |
Regarding the repository.Repository struct:
Repository.Users
: users that with write accessRepository.ReadOnlyUsers
: users with read-only accessImplementation notes:
allowed read access
collections of users
Please review, comment, suggest and advise! 😉