New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support to protect tags with group_id or user_id #1540
Conversation
@svanharmelen would you be able to review this? I'm hoping get this updated so that I can get a downstream issue resolved |
protected_tags.go
Outdated
@@ -46,6 +46,8 @@ type ProtectedTag struct { | |||
type TagAccessDescription struct { | |||
AccessLevel AccessLevelValue `json:"access_level"` | |||
AccessLevelDescription string `json:"access_level_description"` | |||
UserID *int `url:"user_id,omitempty" json:"user_id,omitempty"` | |||
GroupID *int `url:"group_id,omitempty" json:"group_id,omitempty"` |
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 cannot see in the docs that these fields need to be here. Can you point me to somewhere (in the code) that shows these fields exist in this struct?
Additionally in a response struct like this we don't use pointers for build-in types and URL tags.
protected_tags.go
Outdated
// | ||
// GitLab API docs: | ||
// https://docs.gitlab.com/ee/api/protected_tags.html#protect-repository-tags | ||
type ProtectRepositoryTagsPermissionOptions struct { |
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.
Maybe make this just a little shorter, like TagsPermissionOptions
or something?
protected_tags.go
Outdated
CreateAccessLevel *AccessLevelValue `url:"create_access_level,omitempty" json:"create_access_level,omitempty"` | ||
Name *string `url:"name" json:"name"` | ||
CreateAccessLevel *AccessLevelValue `url:"create_access_level,omitempty" json:"create_access_level,omitempty"` | ||
AllowedToCreate *[]ProtectRepositoryTagsPermissionOptions `url:"allowed_to_create,omitempty" json:"allowed_to_create,omitempty"` |
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.
AllowedToCreate *[]ProtectRepositoryTagsPermissionOptions `url:"allowed_to_create,omitempty" json:"allowed_to_create,omitempty"` | |
AllowedToCreate *[]*ProtectRepositoryTagsPermissionOptions `url:"allowed_to_create,omitempty" json:"allowed_to_create,omitempty"` |
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'm still not sure if these (user_id
and group_id
) fields exist in the TagAccessDescription
response, but I fixed up the PR and went ahead to merge it...
This resolves #1511