Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
13d89bae
authored
Mar 03, 2016
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'issue-437' into 'master'
Fix add port permissions closes #437 See merge request !359
parents
50ac15ee
b2bb54c4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
5 deletions
+11
-5
circle/common/operations.py
+3
-2
circle/dashboard/templates/dashboard/vm-detail/_network-port-add.html
+1
-1
circle/dashboard/templates/dashboard/vm-detail/network.html
+5
-2
circle/vm/operations.py
+2
-0
No files found.
circle/common/operations.py
View file @
13d89bae
...
@@ -175,8 +175,9 @@ class Operation(object):
...
@@ -175,8 +175,9 @@ class Operation(object):
raise
ImproperlyConfigured
(
raise
ImproperlyConfigured
(
"Set required_perms to () if none needed."
)
"Set required_perms to () if none needed."
)
if
not
user
.
has_perms
(
cls
.
required_perms
):
if
not
user
.
has_perms
(
cls
.
required_perms
):
raise
PermissionDenied
(
raise
humanize_exception
(
ugettext_noop
(
u"
%
s doesn't have the required permissions."
%
user
)
"You don't have the required permissions."
),
PermissionDenied
())
if
cls
.
superuser_required
and
not
user
.
is_superuser
:
if
cls
.
superuser_required
and
not
user
.
is_superuser
:
raise
humanize_exception
(
ugettext_noop
(
raise
humanize_exception
(
ugettext_noop
(
"Superuser privileges are required."
),
PermissionDenied
())
"Superuser privileges are required."
),
PermissionDenied
())
...
...
circle/dashboard/templates/dashboard/vm-detail/_network-port-add.html
View file @
13d89bae
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
<select
class=
"form-control"
name=
"proto"
style=
"width: 70px;"
><option>
tcp
</option><option>
udp
</option></select>
<select
class=
"form-control"
name=
"proto"
style=
"width: 70px;"
><option>
tcp
</option><option>
udp
</option></select>
<div
class=
"input-group-btn"
>
<div
class=
"input-group-btn"
>
<button
type=
"submit"
class=
"btn btn-success btn-sm
<button
type=
"submit"
class=
"btn btn-success btn-sm
{% if not
is_operator
%}disabled{% endif %}"
>
{% if not
op.add_port
%}disabled{% endif %}"
>
<span
class=
"hidden-xs"
>
{% trans "Add" %}
</span>
<span
class=
"hidden-xs"
>
{% trans "Add" %}
</span>
<span
class=
"visible-xs"
><i
class=
"fa fa-plus-circle"
></i></span>
<span
class=
"visible-xs"
><i
class=
"fa fa-plus-circle"
></i></span>
</button>
</button>
...
...
circle/dashboard/templates/dashboard/vm-detail/network.html
View file @
13d89bae
...
@@ -83,7 +83,8 @@
...
@@ -83,7 +83,8 @@
<span
class=
"operation-wrapper"
>
<span
class=
"operation-wrapper"
>
<a
href=
"{{ op.remove_port.get_url }}?rule={{ l.ipv4.pk }}"
<a
href=
"{{ op.remove_port.get_url }}?rule={{ l.ipv4.pk }}"
class=
"btn btn-link btn-xs operation"
class=
"btn btn-link btn-xs operation"
title=
"{% trans "
Remove
"
%}"
>
title=
"{% trans "
Remove
"
%}"
{%
if
not
op
.
remove_port
%}
disabled
{%
endif
%}
>
<i
class=
"fa fa-times"
><span
class=
"sr-only"
>
{% trans "Remove" %}
</span></i>
<i
class=
"fa fa-times"
><span
class=
"sr-only"
>
{% trans "Remove" %}
</span></i>
</a>
</a>
</span>
</span>
...
@@ -118,7 +119,9 @@
...
@@ -118,7 +119,9 @@
{{ l.private }}/{{ l.proto }}
{{ l.private }}/{{ l.proto }}
</td>
</td>
<td>
<td>
<a
href=
"{{ op.remove_port.get_url }}?rule={{ l.ipv4.pk }}"
class=
"btn btn-link btn-xs vm-details-remove-port"
data-rule=
"{{ l.ipv6.pk }}"
title=
"{% trans "
Remove
"
%}"
><i
class=
"fa fa-times"
><span
class=
"sr-only"
>
{% trans "Remove" %}
</span></i></a>
<a
href=
"{{ op.remove_port.get_url }}?rule={{ l.ipv4.pk }}"
class=
"btn btn-link btn-xs vm-details-remove-port"
data-rule=
"{{ l.ipv6.pk }}"
title=
"{% trans "
Remove
"
%}"
{%
if
not
op
.
remove_port
%}
disabled
{%
endif
%}
>
<i
class=
"fa fa-times"
><span
class=
"sr-only"
>
{% trans "Remove" %}
</span></i>
</a>
</td>
</td>
</tr>
</tr>
{% endif %}
{% endif %}
...
...
circle/vm/operations.py
View file @
13d89bae
...
@@ -629,6 +629,7 @@ class RemovePortOperation(InstanceOperation):
...
@@ -629,6 +629,7 @@ class RemovePortOperation(InstanceOperation):
name
=
_
(
"close port"
)
name
=
_
(
"close port"
)
description
=
_
(
"Close the specified port."
)
description
=
_
(
"Close the specified port."
)
concurrency_check
=
False
concurrency_check
=
False
acl_level
=
"operator"
required_perms
=
(
'vm.config_ports'
,
)
required_perms
=
(
'vm.config_ports'
,
)
def
_operation
(
self
,
activity
,
rule
):
def
_operation
(
self
,
activity
,
rule
):
...
@@ -647,6 +648,7 @@ class AddPortOperation(InstanceOperation):
...
@@ -647,6 +648,7 @@ class AddPortOperation(InstanceOperation):
name
=
_
(
"open port"
)
name
=
_
(
"open port"
)
description
=
_
(
"Open the specified port."
)
description
=
_
(
"Open the specified port."
)
concurrency_check
=
False
concurrency_check
=
False
acl_level
=
"operator"
required_perms
=
(
'vm.config_ports'
,
)
required_perms
=
(
'vm.config_ports'
,
)
def
_operation
(
self
,
activity
,
host
,
proto
,
port
):
def
_operation
(
self
,
activity
,
host
,
proto
,
port
):
...
...
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