FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-gitlab/gitlab/v4/objects/members.py at master · icanka/python-gitlab · GitHub
icanka
python-gitlab
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-gitlab
/
gitlab
/
v4
/
objects
/
members.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
94 lines (74 loc) · 3.2 KB
Breadcrumbs
python-gitlab
/
gitlab
/
v4
/
objects
/
members.py
Copy path
File metadata and controls
94 lines (74 loc) · 3.2 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
from
gitlab
import
cli
from
gitlab
import
exceptions
as
exc
from
gitlab
.
base
import
RequiredOptional
,
RESTManager
,
RESTObject
from
gitlab
.
mixins
import
CRUDMixin
,
ObjectDeleteMixin
,
SaveMixin
__all__
=
[
"GroupMember"
,
"GroupMemberManager"
,
"ProjectMember"
,
"ProjectMemberManager"
,
]
class
GroupMember
(
SaveMixin
,
ObjectDeleteMixin
,
RESTObject
):
_short_print_attr
=
"username"
class
GroupMemberManager
(
CRUDMixin
,
RESTManager
):
_path
=
"/groups/%(group_id)s/members"
_obj_cls
=
GroupMember
_from_parent_attrs
=
{
"group_id"
:
"id"
}
_create_attrs
=
RequiredOptional
(
required
=
(
"access_level"
,
"user_id"
),
optional
=
(
"expires_at"
,)
)
_update_attrs
=
RequiredOptional
(
required
=
(
"access_level"
,),
optional
=
(
"expires_at"
,)
)
@
cli
.
register_custom_action
(
"GroupMemberManager"
)
@
exc
.
on_http_error
(
exc
.
GitlabListError
)
def
all
(
self
,
**
kwargs
):
"""List all the members, included inherited ones.
Args:
all (bool): If True, return all the items, without pagination
per_page (int): Number of items to retrieve per request
page (int): ID of the page to return (starts with page 1)
as_list (bool): If set to False and no pagination option is
defined, return a generator instead of a list
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabListError: If the list could not be retrieved
Returns:
RESTObjectList: The list of members
"""
path
=
"%s/all"
%
self
.
path
obj
=
self
.
gitlab
.
http_list
(
path
,
**
kwargs
)
return
[
self
.
_obj_cls
(
self
,
item
)
for
item
in
obj
]
class
ProjectMember
(
SaveMixin
,
ObjectDeleteMixin
,
RESTObject
):
_short_print_attr
=
"username"
class
ProjectMemberManager
(
CRUDMixin
,
RESTManager
):
_path
=
"/projects/%(project_id)s/members"
_obj_cls
=
ProjectMember
_from_parent_attrs
=
{
"project_id"
:
"id"
}
_create_attrs
=
RequiredOptional
(
required
=
(
"access_level"
,
"user_id"
),
optional
=
(
"expires_at"
,)
)
_update_attrs
=
RequiredOptional
(
required
=
(
"access_level"
,),
optional
=
(
"expires_at"
,)
)
@
cli
.
register_custom_action
(
"ProjectMemberManager"
)
@
exc
.
on_http_error
(
exc
.
GitlabListError
)
def
all
(
self
,
**
kwargs
):
"""List all the members, included inherited ones.
Args:
all (bool): If True, return all the items, without pagination
per_page (int): Number of items to retrieve per request
page (int): ID of the page to return (starts with page 1)
as_list (bool): If set to False and no pagination option is
defined, return a generator instead of a list
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabListError: If the list could not be retrieved
Returns:
RESTObjectList: The list of members
"""
path
=
"%s/all"
%
self
.
path
obj
=
self
.
gitlab
.
http_list
(
path
,
**
kwargs
)
return
[
self
.
_obj_cls
(
self
,
item
)
for
item
in
obj
]
Back
|
FazBrowse Home
|
New Git URL