Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scheduling-system
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SMASCH
scheduling-system
Commits
2972e59b
Commit
2972e59b
authored
5 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
modif_flyingteam permission implemented
parent
2a5a47c2
No related branches found
No related tags found
1 merge request
!228
Resolve "some permissions should be added"
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
smash/web/templates/sidebar.html
+2
-0
2 additions, 0 deletions
smash/web/templates/sidebar.html
smash/web/tests/view/test_flying_teams.py
+14
-0
14 additions, 0 deletions
smash/web/tests/view/test_flying_teams.py
smash/web/views/flying_teams.py
+6
-1
6 additions, 1 deletion
smash/web/views/flying_teams.py
with
22 additions
and
1 deletion
smash/web/templates/sidebar.html
+
2
−
0
View file @
2972e59b
...
...
@@ -48,7 +48,9 @@
{% if "change_appointmenttype" in permissions %}
<li
data-desc=
"appointment_types"
><a
href=
"{% url 'web.views.appointment_types' %}"
>
Appointment Types
</a></li>
{% endif %}
{% if "change_flyingteam" in permissions %}
<li
data-desc=
"flying_teams"
><a
href=
"{% url 'web.views.equipment_and_rooms.flying_teams' %}"
>
Flying teams
</a></li>
{% endif %}
<li
data-desc=
"kit_requests"
><a
href=
"{% url 'web.views.kit_requests' %}"
>
Kit requests
</a></li>
<li
data-desc=
"rooms"
><a
href=
"{% url 'web.views.equipment_and_rooms.rooms' %}"
>
Rooms
</a></li>
</ul>
...
...
This diff is collapsed.
Click to expand it.
smash/web/tests/view/test_flying_teams.py
+
14
−
0
View file @
2972e59b
...
...
@@ -17,6 +17,7 @@ class FlyingTeamTests(LoggedInTestCase):
return
'
Random
'
+
''
.
join
(
random
.
choice
(
letters
)
for
x
in
range
(
15
))
def
test_flying_team_requests
(
self
):
self
.
login_as_admin
()
pages
=
[
'
web.views.equipment_and_rooms.flying_teams
'
,
'
web.views.equipment_and_rooms.flying_teams_add
'
,
...
...
@@ -26,7 +27,18 @@ class FlyingTeamTests(LoggedInTestCase):
response
=
self
.
client
.
get
(
reverse
(
page
))
self
.
assertEqual
(
response
.
status_code
,
200
)
def
test_flying_team_requests_without_permission
(
self
):
pages
=
[
'
web.views.equipment_and_rooms.flying_teams
'
,
'
web.views.equipment_and_rooms.flying_teams_add
'
,
]
for
page
in
pages
:
response
=
self
.
client
.
get
(
reverse
(
page
))
self
.
assertEqual
(
response
.
status_code
,
302
)
def
test_flying_team_add
(
self
):
self
.
login_as_admin
()
page
=
reverse
(
'
web.views.equipment_and_rooms.flying_teams_add
'
)
data
=
{
'
place
'
:
self
.
generate_more_or_less_random_name
()
...
...
@@ -38,6 +50,7 @@ class FlyingTeamTests(LoggedInTestCase):
self
.
assertEqual
(
len
(
freshly_created
),
1
)
def
test_flying_team_edit
(
self
):
self
.
login_as_admin
()
flying_team
=
create_flying_team
()
page
=
reverse
(
'
web.views.equipment_and_rooms.flying_teams_edit
'
,
kwargs
=
{
'
flying_team_id
'
:
str
(
flying_team
.
id
)})
...
...
@@ -51,6 +64,7 @@ class FlyingTeamTests(LoggedInTestCase):
self
.
assertEqual
(
freshly_edited
.
place
,
data
[
"
place
"
])
def
test_flying_team_edit_request
(
self
):
self
.
login_as_admin
()
flying_team
=
create_flying_team
()
page
=
reverse
(
'
web.views.equipment_and_rooms.flying_teams_edit
'
,
kwargs
=
{
'
flying_team_id
'
:
str
(
flying_team
.
id
)})
...
...
This diff is collapsed.
Click to expand it.
smash/web/views/flying_teams.py
+
6
−
1
View file @
2972e59b
# coding=utf-8
from
django.shortcuts
import
redirect
,
get_object_or_404
from
web.decorators
import
PermissionDecorator
from
.
import
wrap_response
from
..models
import
FlyingTeam
from
..forms.forms
import
FlyingTeamAddForm
,
FlyingTeamEditForm
from
..models
import
FlyingTeam
@PermissionDecorator
(
'
change_flyingteam
'
,
'
item
'
)
def
flying_teams
(
request
):
flying_team_list
=
FlyingTeam
.
objects
.
order_by
(
'
-place
'
)
context
=
{
...
...
@@ -16,6 +18,8 @@ def flying_teams(request):
"
equipment_and_rooms/flying_teams/index.html
"
,
context
)
@PermissionDecorator
(
'
change_flyingteam
'
,
'
item
'
)
def
flying_teams_add
(
request
):
if
request
.
method
==
'
POST
'
:
form
=
FlyingTeamAddForm
(
request
.
POST
)
...
...
@@ -28,6 +32,7 @@ def flying_teams_add(request):
return
wrap_response
(
request
,
'
equipment_and_rooms/flying_teams/add.html
'
,
{
'
form
'
:
form
})
@PermissionDecorator
(
'
change_flyingteam
'
,
'
item
'
)
def
flying_teams_edit
(
request
,
flying_team_id
):
the_flying_team
=
get_object_or_404
(
FlyingTeam
,
id
=
flying_team_id
)
if
request
.
method
==
'
POST
'
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment