Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add capability to control GitLab features per project or group#1008

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletionsdocs/gl_objects/features.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,6 +24,8 @@ Create or set a feature::

feature = gl.features.set(feature_name, True)
feature = gl.features.set(feature_name, 30)
feature = gl.features.set(feature_name, True, user=filipowm)
feature = gl.features.set(feature_name, 40, group=mygroup)

Delete a feature::

Expand Down
4 changes: 4 additions & 0 deletionsgitlab/utils.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -55,3 +55,7 @@ def sanitized_url(url):
parsed = urlparse(url)
new_path = parsed.path.replace(".", "%2E")
return parsed._replace(path=new_path).geturl()


def remove_none_from_dict(data):
return {k: v for k, v in data.items() if v is not None}
22 changes: 20 additions & 2 deletionsgitlab/v4/objects.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -724,14 +724,25 @@ class FeatureManager(ListMixin, DeleteMixin, RESTManager):
_obj_cls = Feature

@exc.on_http_error(exc.GitlabSetError)
def set(self, name, value, feature_group=None, user=None, **kwargs):
def set(
self,
name,
value,
feature_group=None,
user=None,
group=None,
project=None,
**kwargs
):
"""Create or update the object.

Args:
name (str): The value to set for the object
value (bool/int): The value to set for the object
feature_group (str): A feature group name
user (str): A GitLab username
group (str): A GitLab group
project (str): A GitLab project in form group/project
**kwargs: Extra options to send to the server (e.g. sudo)

Raises:
Expand All@@ -742,7 +753,14 @@ def set(self, name, value, feature_group=None, user=None, **kwargs):
obj: The created/updated attribute
"""
path = "%s/%s" % (self.path, name.replace("/", "%2F"))
data = {"value": value, "feature_group": feature_group, "user": user}
data = {
"value": value,
"feature_group": feature_group,
"user": user,
"group": group,
"project": project,
}
data = utils.remove_none_from_dict(data)
server_data = self.gitlab.http_post(path, post_data=data, **kwargs)
return self._obj_cls(self, server_data)

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp