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
2a1c5cdf
Commit
2a1c5cdf
authored
Dec 04, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only owner of current namespace can change project namespace
parent
f6bfa095
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
9 deletions
+15
-9
app/contexts/project_update_context.rb
app/contexts/project_update_context.rb
+1
-1
app/models/ability.rb
app/models/ability.rb
+5
-5
app/views/projects/_form.html.haml
app/views/projects/_form.html.haml
+9
-3
No files found.
app/contexts/project_update_context.rb
View file @
2a1c5cdf
...
...
@@ -2,7 +2,7 @@ class ProjectUpdateContext < BaseContext
def
execute
(
role
=
:default
)
namespace_id
=
params
[
:project
].
delete
(
:namespace_id
)
if
namespace_id
.
present?
if
can?
(
current_user
,
:change_namespace
,
project
)
&&
namespace_id
.
present?
if
namespace_id
==
Namespace
.
global_id
if
project
.
namespace
.
present?
# Transfer to global namespace from anyone
...
...
app/models/ability.rb
View file @
2a1c5cdf
...
...
@@ -17,9 +17,7 @@ class Ability
# Rules based on role in project
if
project
.
master_access_for?
(
user
)
# TODO: replace with master rules.
# Only allow project administration for namespace owners
rules
<<
project_admin_rules
rules
<<
project_master_rules
elsif
project
.
dev_access_for?
(
user
)
rules
<<
project_dev_rules
...
...
@@ -93,13 +91,15 @@ class Ability
:admin_merge_request
,
:admin_note
,
:accept_mr
,
:admin_wiki
:admin_wiki
,
:admin_project
]
end
def
project_admin_rules
project_master_rules
+
[
:admin_project
:change_namespace
,
:rename_project
]
end
...
...
app/views/projects/_form.html.haml
View file @
2a1c5cdf
...
...
@@ -21,9 +21,15 @@
=
f
.
label
:namespace_id
do
%span
Namespace
.controls
-
if
can?
current_user
,
:change_namespace
,
@project
=
f
.
select
:namespace_id
,
namespaces_options
(
@project
.
namespace_id
),
{
prompt:
'Choose a project namespace'
},
{
class:
'chosen'
}
%span
.cred
Be careful. Changing project namespace can have unintended side effects
-
else
%a
.btn.btn-small.disabled
=
@project
.
namespace
.
try
(
:human_name
)
||
"/"
%span
.cred
Only owner can change project namespace.
-
unless
@project
.
heads
.
empty?
.clearfix
...
...
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