Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
R
red-ci-cd
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
red-group-test
red-ci-cd
Commits
53435a62
Commit
53435a62
authored
Feb 04, 2020
by
Gladys Forte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
{dev bugfix} Do not allow to save Vendor same level to other delegation Template Post
parent
9bfe763a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
3 deletions
+25
-3
app/businesslayer/changerequest/change_request_template.py
app/businesslayer/changerequest/change_request_template.py
+16
-1
app/helper/decorators.py
app/helper/decorators.py
+9
-2
No files found.
app/businesslayer/changerequest/change_request_template.py
View file @
53435a62
...
@@ -172,5 +172,20 @@ def validation_poc_vendor_only(poc, approvers):
...
@@ -172,5 +172,20 @@ def validation_poc_vendor_only(poc, approvers):
return
validate
return
validate
# Check if level if Vendor delegation has same level with other delegation
def
validation_vendor_unique_level
(
approvers
):
validate
=
False
data_level
=
[]
for
approver
in
approvers
:
if
'delegation'
in
approver
:
if
approver
[
'delegation'
]
==
'DELEGATION-20191119-0000002'
:
data_level
.
append
(
approver
[
'level'
])
for
approver
in
approvers
:
if
'delegation'
in
approver
:
if
approver
[
'level'
]
in
data_level
:
if
not
approver
[
'delegation'
]
==
'DELEGATION-20191119-0000002'
:
validate
=
True
return
validate
\ No newline at end of file
app/helper/decorators.py
View file @
53435a62
...
@@ -14,7 +14,8 @@ from app.businesslayer.changerequest.change_request_template import (
...
@@ -14,7 +14,8 @@ from app.businesslayer.changerequest.change_request_template import (
validation_approver_same_level
,
validation_approver_same_level
,
validation_existing_vendor_requestor
,
validation_existing_vendor_requestor
,
validation_existing_approver
,
validation_existing_approver
,
validation_poc_vendor_only
validation_poc_vendor_only
,
validation_vendor_unique_level
)
)
from
app.applicationlayer.utils
import
error_message
from
app.applicationlayer.utils
import
error_message
...
@@ -307,7 +308,7 @@ def TemplateValidation(function):
...
@@ -307,7 +308,7 @@ def TemplateValidation(function):
'failed'
,
status
.
HTTP_400_BAD_REQUEST
)
'failed'
,
status
.
HTTP_400_BAD_REQUEST
)
# Check if prefix already exists
# Check if prefix already exists
prefix
=
ChangeRequestTemplateHeader
.
objects
.
get
(
prefix
=
ChangeRequestTemplateHeader
.
objects
.
filter
(
requested_to_template_id
=
template_header
[
'requested_to_template_id'
])
requested_to_template_id
=
template_header
[
'requested_to_template_id'
])
if
prefix
:
if
prefix
:
...
@@ -346,6 +347,12 @@ def TemplateValidation(function):
...
@@ -346,6 +347,12 @@ def TemplateValidation(function):
return
error_message
(
'400'
,
'Point of contact can only be assign to Vendor/Implementor'
,
return
error_message
(
'400'
,
'Point of contact can only be assign to Vendor/Implementor'
,
'failed'
,
status
.
HTTP_400_BAD_REQUEST
)
'failed'
,
status
.
HTTP_400_BAD_REQUEST
)
# Do not allow to save Vendor same level to other delegation
validate
=
validation_vendor_unique_level
(
tmp_approvers
)
if
validate
is
True
:
return
error_message
(
'400'
,
'Vendor/Implementor cannot have same level with other delegation/s'
,
'failed'
,
status
.
HTTP_400_BAD_REQUEST
)
return
function
(
self
,
request
,
*
args
,
**
kwargs
)
return
function
(
self
,
request
,
*
args
,
**
kwargs
)
return
wrapper
return
wrapper
...
...
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