Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
b0e37d92
Commit
b0e37d92
authored
Jun 26, 2017
by
Toon Claes
Committed by
Toon Claes
Aug 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add example of User#full_private_access?
One more example how EE-feature regressions can be avoided.
parent
f62a9bfb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
doc/development/ee_features.md
doc/development/ee_features.md
+41
-0
No files found.
doc/development/ee_features.md
View file @
b0e37d92
...
...
@@ -123,6 +123,45 @@ module EE
end
```
#### Use self-descriptive wrapper methods
When it's not possible/logical to modify the implementation of a
method. Wrap it in a self-descriptive method and use that method.
For example, in CE only an
`admin`
is allowed to access all private
projects/groups, but in EE also an
`auditor`
has full private
access. It would be incorrect to override the implementation of
`User#admin?`
, so instead add a method
`full_private_access?`
to
`app/models/users.rb`
. The implementation in CE will be:
```
ruby
def
full_private_access?
admin?
end
```
In EE, the implementation
`app/models/ee/users.rb`
would be:
```
ruby
def
full_private_access?
super
||
auditor?
end
```
In
`lib/gitlab/visibility_level.rb`
this method is used to return the
allowed visibilty levels:
```
ruby
def
levels_for_user
(
user
=
nil
)
if
user
.
full_private_access?
[
PRIVATE
,
INTERNAL
,
PUBLIC
]
elsif
# ...
end
```
See
[
CE MR
](
ce-mr-full-private
)
and
[
EE MR
](
ee-mr-full-private
)
for
full implementation details.
### Code in `app/controllers/`
In controllers, the most common type of conflict is with
`before_action`
that
...
...
@@ -203,3 +242,5 @@ RSpec/FilePath` to disable the cop for that line.
[
ee-as-ce
]:
https://gitlab.com/gitlab-org/gitlab-ee/issues/2500
[
ee-features-list
]:
https://gitlab.com/gitlab-com/www-gitlab-com/blob/master/data/features.yml
[
ce-mr-full-private
]:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12373
[
ee-mr-full-private
]:
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/2199
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment