| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c579c80 commit 3711f19
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -117,3 +117,13 @@ Use the ``all`` parameter to get all the items: | |||
| 117 | 117 | .. code-block:: python | |
| 118 | 118 | ||
| 119 | 119 | all_groups = gl.groups.list(all=True) | |
| 120 | + | ||
| 121 | + Sudo | ||
| 122 | + ==== | ||
| 123 | + | ||
| 124 | + If you have the administrator status, you can use ``sudo`` to act as another | ||
| 125 | + user. For example: | ||
| 126 | + | ||
| 127 | + .. code-block:: python | ||
| 128 | + | ||
| 129 | + p = gl.projects.create({'name': 'awesome_project'}, sudo='user1') | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -189,3 +189,9 @@ Define the status of a commit (as would be done from a CI tool for example): | |||
| 189 | 189 | --commit-id a43290c --state success --name ci/jenkins \ | |
| 190 | 190 | --target-url http://server/build/123 \ | |
| 191 | 191 | --description "Jenkins build succeeded" | |
| 192 | + | ||
| 193 | + Use sudo to act as another user (admin only): | ||
| 194 | + | ||
| 195 | + .. code-block:: console | ||
| 196 | + | ||
| 197 | + $ gitlab project create --name user_project1 --sudo username | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -73,6 +73,7 @@ def _populate_sub_parser_by_class(cls, sub_parser): | |||
| 73 | 73 | [sub_parser_action.add_argument("--%s" % x.replace('_', '-'), | |
| 74 | 74 | required=True) | |
| 75 | 75 | for x in cls.requiredUrlAttrs] | |
| 76 | + sub_parser_action.add_argument("--sudo", required=False) | ||
| 76 | 77 | ||
| 77 | 78 | if action_name == LIST: | |
| 78 | 79 | [sub_parser_action.add_argument("--%s" % x.replace('_', '-'), | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -227,6 +227,7 @@ def _data_for_gitlab(self, extra_parameters={}, update=False): | |||
| 227 | 227 | else: | |
| 228 | 228 | attributes = itertools.chain(self.requiredCreateAttrs, | |
| 229 | 229 | self.optionalCreateAttrs) | |
| 230 | + attributes = list(attributes) + ['sudo', 'page', 'per_page'] | ||
| 230 | 231 | for attribute in attributes: | |
| 231 | 232 | if hasattr(self, attribute): | |
| 232 | 233 | data[attribute] = getattr(self, attribute) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -98,8 +98,9 @@ | |||
| 98 | 98 | 'namespace_id': group1.id}) | |
| 99 | 99 | gr2_project = gl.projects.create({'name': 'gr2_project', | |
| 100 | 100 | 'namespace_id': group2.id}) | |
| 101 | + sudo_project = gl.projects.create({'name': 'sudo_project'}, sudo=user1.name) | ||
| 101 | 102 | ||
| 102 | - assert(len(gl.projects.all()) == 3) | ||
| 103 | + assert(len(gl.projects.all()) == 4) | ||
| 103 | 104 | assert(len(gl.projects.owned()) == 2) | |
| 104 | 105 | assert(len(gl.projects.search("admin")) == 1) | |
| 105 | 106 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments