Module: Gitlab::Access
Defined Under Namespace
Classes: BranchProtection
Constant Summary
collapse
- AccessDeniedError =
Class.new(StandardError)
- NO_ACCESS =
0
- MINIMAL_ACCESS =
5
- GUEST =
10
- REPORTER =
20
- DEVELOPER =
30
- MAINTAINER =
40
- OWNER =
50
- PROTECTION_NONE =
Branch protection settings
0
- PROTECTION_DEV_CAN_PUSH =
1
- PROTECTION_FULL =
2
- PROTECTION_DEV_CAN_MERGE =
3
- NO_ONE_PROJECT_ACCESS =
Default project creation level
0
- MAINTAINER_PROJECT_ACCESS =
1
- DEVELOPER_MAINTAINER_PROJECT_ACCESS =
2
- OWNER_SUBGROUP_ACCESS =
Default subgroup creation level
0
- MAINTAINER_SUBGROUP_ACCESS =
1
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.all_values ⇒ Object
38
39
40
|
# File 'lib/gitlab/access.rb', line 38
def all_values
options_with_owner.values
end
|
.human_access(access) ⇒ Object
89
90
91
|
# File 'lib/gitlab/access.rb', line 89
def human_access(access)
options_with_owner.key(access)
end
|
.human_access_with_none(access) ⇒ Object
93
94
95
|
# File 'lib/gitlab/access.rb', line 93
def human_access_with_none(access)
options_with_none.key(access)
end
|
.options ⇒ Object
42
43
44
45
46
47
48
49
|
# File 'lib/gitlab/access.rb', line 42
def options
{
"Guest" => GUEST,
"Reporter" => REPORTER,
"Developer" => DEVELOPER,
"Maintainer" => MAINTAINER
}
end
|
.options_with_none ⇒ Object
57
58
59
60
61
|
# File 'lib/gitlab/access.rb', line 57
def options_with_none
options_with_owner.merge(
"None" => NO_ACCESS
)
end
|
.options_with_owner ⇒ Object
51
52
53
54
55
|
# File 'lib/gitlab/access.rb', line 51
def options_with_owner
options.merge(
"Owner" => OWNER
)
end
|
.project_creation_level_name(name) ⇒ Object
121
122
123
|
# File 'lib/gitlab/access.rb', line 121
def project_creation_level_name(name)
project_creation_options.key(name)
end
|
.project_creation_options ⇒ Object
.project_creation_string_options ⇒ Object
.project_creation_string_values ⇒ Object
117
118
119
|
# File 'lib/gitlab/access.rb', line 117
def project_creation_string_values
project_creation_string_options.keys
end
|
.project_creation_values ⇒ Object
113
114
115
|
# File 'lib/gitlab/access.rb', line 113
def project_creation_values
project_creation_options.values
end
|
.protection_options ⇒ Object
76
77
78
79
80
81
82
83
|
# File 'lib/gitlab/access.rb', line 76
def protection_options
{
"Not protected: Both developers and maintainers can push new commits, force push, or delete the branch." => PROTECTION_NONE,
"Protected against pushes: Developers cannot push new commits, but are allowed to accept merge requests to the branch. Maintainers can push to the branch." => PROTECTION_DEV_CAN_MERGE,
"Partially protected: Both developers and maintainers can push new commits, but cannot force push or delete the branch." => PROTECTION_DEV_CAN_PUSH,
"Fully protected: Developers cannot push new commits, but maintainers can. No-one can force push or delete the branch." => PROTECTION_FULL
}
end
|
.protection_values ⇒ Object
85
86
87
|
# File 'lib/gitlab/access.rb', line 85
def protection_values
protection_options.values
end
|
.subgroup_creation_options ⇒ Object
.subgroup_creation_string_options ⇒ Object
.subgroup_creation_string_values ⇒ Object
143
144
145
|
# File 'lib/gitlab/access.rb', line 143
def subgroup_creation_string_values
subgroup_creation_string_options.keys
end
|
.subgroup_creation_values ⇒ Object
139
140
141
|
# File 'lib/gitlab/access.rb', line 139
def subgroup_creation_values
subgroup_creation_options.values
end
|
.sym_options ⇒ Object
63
64
65
66
67
68
69
70
|
# File 'lib/gitlab/access.rb', line 63
def sym_options
{
guest: GUEST,
reporter: REPORTER,
developer: DEVELOPER,
maintainer: MAINTAINER
}
end
|
.sym_options_with_owner ⇒ Object
72
73
74
|
# File 'lib/gitlab/access.rb', line 72
def sym_options_with_owner
sym_options.merge(owner: OWNER)
end
|
Instance Method Details
#human_access_with_none ⇒ Object
#owner? ⇒ Boolean
156
157
158
|
# File 'lib/gitlab/access.rb', line 156
def owner?
access_field == OWNER
end
|