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
9bcd3639
Commit
9bcd3639
authored
May 25, 2015
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor permission checks to use `can?` instead of `issues_enabled` and `merge_requests_enabled`
parent
bdf7b44a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
6 deletions
+21
-6
CHANGELOG
CHANGELOG
+1
-0
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+12
-4
app/models/ability.rb
app/models/ability.rb
+5
-0
app/views/projects/milestones/show.html.haml
app/views/projects/milestones/show.html.haml
+3
-2
No files found.
CHANGELOG
View file @
9bcd3639
Please view this file on the master branch, on stable branches it's out of date.
Please view this file on the master branch, on stable branches it's out of date.
v 7.12.0 (unreleased)
v 7.12.0 (unreleased)
- Refactor permission checks with issues and merge requests project settings (Stan Hu)
- Add web hook support for note events (Stan Hu)
- Add web hook support for note events (Stan Hu)
- Disable "New Issue" and "New Merge Request" buttons when features are disabled in project settings (Stan Hu)
- Disable "New Issue" and "New Merge Request" buttons when features are disabled in project settings (Stan Hu)
- Allow to configure location of the `.gitlab_shell_secret` file. (Jakub Jirutka)
- Allow to configure location of the `.gitlab_shell_secret` file. (Jakub Jirutka)
...
...
app/helpers/projects_helper.rb
View file @
9bcd3639
...
@@ -148,7 +148,7 @@ module ProjectsHelper
...
@@ -148,7 +148,7 @@ module ProjectsHelper
nav_tabs
<<
[
:files
,
:commits
,
:network
,
:graphs
]
nav_tabs
<<
[
:files
,
:commits
,
:network
,
:graphs
]
end
end
if
project
.
repo_exists?
&&
project
.
merge_requests_enabled
if
project
.
repo_exists?
&&
can?
(
current_user
,
:read_merge_request
,
project
)
nav_tabs
<<
:merge_requests
nav_tabs
<<
:merge_requests
end
end
...
@@ -156,11 +156,19 @@ module ProjectsHelper
...
@@ -156,11 +156,19 @@ module ProjectsHelper
nav_tabs
<<
:settings
nav_tabs
<<
:settings
end
end
[
:issues
,
:wiki
,
:snippets
].
each
do
|
feature
|
if
can?
(
current_user
,
:read_issue
,
project
)
nav_tabs
<<
feature
if
project
.
send
:"
#{
feature
}
_enabled"
nav_tabs
<<
:issues
end
end
if
project
.
issues_enabled
||
project
.
merge_requests_enabled
if
can?
(
current_user
,
:read_wiki
,
project
)
nav_tabs
<<
:wiki
end
if
can?
(
current_user
,
:read_project_snippet
,
project
)
nav_tabs
<<
:snippets
end
if
can?
(
current_user
,
:read_milestone
,
project
)
nav_tabs
<<
[
:milestones
,
:labels
]
nav_tabs
<<
[
:milestones
,
:labels
]
end
end
...
...
app/models/ability.rb
View file @
9bcd3639
...
@@ -109,6 +109,11 @@ class Ability
...
@@ -109,6 +109,11 @@ class Ability
rules
-=
named_abilities
(
'merge_request'
)
rules
-=
named_abilities
(
'merge_request'
)
end
end
unless
project
.
issues_enabled
or
project
.
merge_requests_enabled
rules
-=
named_abilities
(
'label'
)
rules
-=
named_abilities
(
'milestone'
)
end
unless
project
.
snippets_enabled
unless
project
.
snippets_enabled
rules
-=
named_abilities
(
'snippet'
)
rules
-=
named_abilities
(
'snippet'
)
end
end
...
...
app/views/projects/milestones/show.html.haml
View file @
9bcd3639
...
@@ -61,11 +61,12 @@
...
@@ -61,11 +61,12 @@
Participants
Participants
%span
.badge
=
@users
.
count
%span
.badge
=
@users
.
count
-
if
can?
(
current_user
,
:write_issue
,
@project
)
.pull-right
.pull-right
-
if
can?
(
current_user
,
:write_issue
,
@project
)
=
link_to
new_namespace_project_issue_path
(
@project
.
namespace
,
@project
,
issue:
{
milestone_id:
@milestone
.
id
}),
class:
"btn btn-grouped"
,
title:
"New Issue"
do
=
link_to
new_namespace_project_issue_path
(
@project
.
namespace
,
@project
,
issue:
{
milestone_id:
@milestone
.
id
}),
class:
"btn btn-grouped"
,
title:
"New Issue"
do
%i
.fa.fa-plus
%i
.fa.fa-plus
New Issue
New Issue
-
if
can?
(
current_user
,
:read_issue
,
@project
)
=
link_to
'Browse Issues'
,
namespace_project_issues_path
(
@milestone
.
project
.
namespace
,
@milestone
.
project
,
milestone_id:
@milestone
.
id
),
class:
"btn edit-milestone-link btn-grouped"
=
link_to
'Browse Issues'
,
namespace_project_issues_path
(
@milestone
.
project
.
namespace
,
@milestone
.
project
,
milestone_id:
@milestone
.
id
),
class:
"btn edit-milestone-link btn-grouped"
.tab-content
.tab-content
...
...
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