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
267839c8
Commit
267839c8
authored
Aug 16, 2018
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add separate permission to delete packages
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
adf209e6
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
8 additions
and
5 deletions
+8
-5
ee/app/controllers/projects/packages/packages_controller.rb
ee/app/controllers/projects/packages/packages_controller.rb
+1
-1
ee/app/models/packages/package_file.rb
ee/app/models/packages/package_file.rb
+2
-0
ee/app/policies/ee/project_policy.rb
ee/app/policies/ee/project_policy.rb
+1
-0
ee/app/views/projects/packages/packages/index.html.haml
ee/app/views/projects/packages/packages/index.html.haml
+2
-2
ee/app/views/projects/packages/packages/show.html.haml
ee/app/views/projects/packages/packages/show.html.haml
+1
-1
ee/spec/features/projects/packages_spec.rb
ee/spec/features/projects/packages_spec.rb
+1
-1
No files found.
ee/app/controllers/projects/packages/packages_controller.rb
View file @
267839c8
...
...
@@ -3,7 +3,7 @@ module Projects
class
PackagesController
<
ApplicationController
before_action
:verify_packages_enabled!
before_action
:authorize_read_package!
before_action
:authorize_
admin
_package!
,
only:
[
:destroy
]
before_action
:authorize_
destroy
_package!
,
only:
[
:destroy
]
def
index
@packages
=
project
.
packages
.
all
.
page
(
params
[
:page
])
...
...
ee/app/models/packages/package_file.rb
View file @
267839c8
...
...
@@ -6,6 +6,8 @@ class Packages::PackageFile < ActiveRecord::Base
validates
:file
,
presence:
true
validates
:file_name
,
presence:
true
scope
:recent
,
->
{
order
(
id: :desc
)
}
mount_uploader
:file
,
Packages
::
PackageFileUploader
after_save
:update_file_store
,
if: :file_changed?
...
...
ee/app/policies/ee/project_policy.rb
View file @
267839c8
...
...
@@ -114,6 +114,7 @@ module EE
enable
:push_code_to_protected_branches
enable
:admin_path_locks
enable
:update_approvers
enable
:destroy_package
end
rule
{
license_management_enabled
&
can?
(
:maintainer_access
)
}.
enable
:admin_software_license_policy
...
...
ee/app/views/projects/packages/packages/index.html.haml
View file @
267839c8
-
page_title
"Packages"
-
can_
admin_package
=
can?
(
current_user
,
:admin
_package
,
@project
)
-
can_
destroy_package
=
can?
(
current_user
,
:destroy
_package
,
@project
)
-
if
@packages
.
any?
%table
.table
...
...
@@ -23,7 +23,7 @@
%td
=
time_ago_with_tooltip
(
package
.
created_at
)
%td
-
if
can_
admin
_package
-
if
can_
destroy
_package
=
link_to
project_package_path
(
@project
,
package
),
method: :delete
,
data:
{
confirm:
_
(
"Are you sure?"
)
},
class:
"btn btn-grouped btn-inverted btn-remove"
,
title:
_
(
'Delete Package'
)
do
=
icon
(
'trash'
)
...
...
ee/app/views/projects/packages/packages/show.html.haml
View file @
267839c8
...
...
@@ -8,7 +8,7 @@
%strong
=
@package
.
version
.detail-page-header-actions
-
if
can?
(
current_user
,
:
admin
_package
,
@project
)
-
if
can?
(
current_user
,
:
destroy
_package
,
@project
)
=
link_to
project_package_path
(
@project
,
@package
),
method: :delete
,
data:
{
confirm:
_
(
"Are you sure?"
)
},
class:
"btn btn-grouped btn-inverted btn-remove"
,
title:
_
(
'Delete Package'
)
do
=
_
(
'Delete'
)
.row.prepend-top-default
...
...
ee/spec/features/projects/packages_spec.rb
View file @
267839c8
...
...
@@ -7,7 +7,7 @@ describe 'Packages' do
before
do
sign_in
(
user
)
project
.
add_
develop
er
(
user
)
project
.
add_
mast
er
(
user
)
end
context
'when there are no packages'
do
...
...
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