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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
b3b7fb1f
Commit
b3b7fb1f
authored
Aug 23, 2016
by
http://jneen.net/
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove the rest of the dead code
parent
35779223
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
74 deletions
+0
-74
app/models/ability.rb
app/models/ability.rb
+0
-74
No files found.
app/models/ability.rb
View file @
b3b7fb1f
...
...
@@ -63,79 +63,5 @@ class Ability
def
uncached_allowed
(
user
,
subject
)
BasePolicy
.
class_for
(
subject
).
abilities
(
user
,
subject
)
end
def
abilities_by_subject_class
(
user
:,
subject
:)
case
subject
when
ExternalIssue
,
Deployment
,
Environment
then
project_abilities
(
user
,
subject
.
project
)
else
[]
end
+
global_abilities
(
user
)
end
# List of possible abilities for anonymous user
def
anonymous_abilities
(
subject
)
if
subject
.
respond_to?
(
:project
)
ProjectPolicy
.
abilities
(
nil
,
subject
.
project
)
elsif
subject
.
respond_to?
(
:group
)
GroupPolicy
.
abilities
(
nil
,
subject
.
group
)
else
[]
end
end
def
global_abilities
(
user
)
rules
=
[]
rules
<<
:create_group
if
user
.
can_create_group
rules
<<
:read_users_list
rules
end
def
project_abilities
(
user
,
project
)
# temporary patch, deleteme before merge
ProjectPolicy
.
abilities
(
user
,
project
).
to_a
end
def
project_member_abilities
(
user
,
subject
)
rules
=
[]
target_user
=
subject
.
user
project
=
subject
.
project
unless
target_user
==
project
.
owner
can_manage
=
allowed?
(
user
,
:admin_project_member
,
project
)
if
can_manage
rules
<<
:update_project_member
rules
<<
:destroy_project_member
elsif
user
==
target_user
rules
<<
:destroy_project_member
end
end
rules
end
def
filter_build_abilities
(
rules
)
# If we can't read build we should also not have that
# ability when looking at this in context of commit_status
%w(read create update admin)
.
each
do
|
rule
|
rules
.
delete
(
:"
#{
rule
}
_commit_status"
)
unless
rules
.
include?
(
:"
#{
rule
}
_build"
)
end
rules
end
def
restricted_public_level?
current_application_settings
.
restricted_visibility_levels
.
include?
(
Gitlab
::
VisibilityLevel
::
PUBLIC
)
end
def
filter_confidential_issues_abilities
(
user
,
issue
,
rules
)
return
rules
if
user
.
admin?
||
!
issue
.
confidential?
unless
issue
.
author
==
user
||
issue
.
assignee
==
user
||
issue
.
project
.
team
.
member?
(
user
,
Gitlab
::
Access
::
REPORTER
)
rules
.
delete
(
:admin_issue
)
rules
.
delete
(
:read_issue
)
rules
.
delete
(
:update_issue
)
end
rules
end
end
end
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