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
00ac699b
Commit
00ac699b
authored
Sep 17, 2019
by
John Red Medrano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix the value of application on id, add checking on creating user
parent
7b071d6c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
7 deletions
+17
-7
app/applicationlayer/management/account/serializer.py
app/applicationlayer/management/account/serializer.py
+1
-1
app/applicationlayer/management/account/views.py
app/applicationlayer/management/account/views.py
+8
-0
app/helper/decorators.py
app/helper/decorators.py
+8
-6
No files found.
app/applicationlayer/management/account/serializer.py
View file @
00ac699b
...
@@ -15,7 +15,7 @@ class UserSerializer(serializers.ModelSerializer):
...
@@ -15,7 +15,7 @@ class UserSerializer(serializers.ModelSerializer):
ret
[
'department'
]
=
model_to_dict
(
instance
.
department
)
ret
[
'department'
]
=
model_to_dict
(
instance
.
department
)
ret
[
'company'
]
=
model_to_dict
(
instance
.
department
.
company
)
ret
[
'company'
]
=
model_to_dict
(
instance
.
department
.
company
)
# print(instance.application.all())
# print(instance.application.all())
application
=
[
data
[
'id'
]
for
data
in
instance
.
application
.
values
(
'id'
)]
application
=
[
data
[
'id'
]
for
data
in
instance
.
application
.
values
()]
ret
[
'application'
]
=
application
ret
[
'application'
]
=
application
return
ret
return
ret
...
...
app/applicationlayer/management/account/views.py
View file @
00ac699b
...
@@ -30,6 +30,7 @@ class UserViewSet(viewsets.ModelViewSet):
...
@@ -30,6 +30,7 @@ class UserViewSet(viewsets.ModelViewSet):
queryset
=
User
.
objects
.
all
()
queryset
=
User
.
objects
.
all
()
serializer_class
=
serializer
.
UserSerializer
serializer_class
=
serializer
.
UserSerializer
pagination_class
=
CustomPagination
pagination_class
=
CustomPagination
# lookup_field = 'code'
filter_backends
=
(
DjangoFilterBackend
,
SearchFilter
,
OrderingFilter
)
filter_backends
=
(
DjangoFilterBackend
,
SearchFilter
,
OrderingFilter
)
filterset_class
=
UserFilterSet
filterset_class
=
UserFilterSet
ordering_fields
=
'__all__'
ordering_fields
=
'__all__'
...
@@ -110,6 +111,13 @@ class UserViewSet(viewsets.ModelViewSet):
...
@@ -110,6 +111,13 @@ class UserViewSet(viewsets.ModelViewSet):
)
)
@
decorators
.
rms
.
user_list
def
retrieve
(
self
,
request
,
*
args
,
**
kwargs
):
instance
=
self
.
get_object
()
serializer
=
self
.
get_serializer
(
instance
)
return
Response
(
serializer
.
data
)
@
rms
.
user_create
@
rms
.
user_create
@
error_safe
@
error_safe
@
transaction
.
atomic
@
transaction
.
atomic
...
...
app/helper/decorators.py
View file @
00ac699b
...
@@ -77,7 +77,6 @@ class rms:
...
@@ -77,7 +77,6 @@ class rms:
rms
.
access_error
rms
.
access_error
)
)
elif
rms
.
user_type
(
self
)
==
rms
.
enums_department
:
elif
rms
.
user_type
(
self
)
==
rms
.
enums_department
:
print
(
request
.
data
)
if
request
.
data
[
'department'
]
!=
rms
.
user
(
self
)
.
department
.
id
:
if
request
.
data
[
'department'
]
!=
rms
.
user
(
self
)
.
department
.
id
:
raise
ParseError
(
raise
ParseError
(
rms
.
department_error
rms
.
department_error
...
@@ -109,9 +108,13 @@ class rms:
...
@@ -109,9 +108,13 @@ class rms:
def
department_crate
(
function
):
def
department_crate
(
function
):
@
wraps
(
function
)
@
wraps
(
function
)
def
wrapper
(
self
,
request
,
*
args
,
**
kwargs
):
def
wrapper
(
self
,
request
,
*
args
,
**
kwargs
):
if
rms
.
user_type
(
self
)
==
rms
.
enums_super
:
# if rms.user_type(self) == rms.enums_super:
pass
# pass
elif
rms
.
user_type
(
self
)
!=
rms
.
enums_super
or
rms
.
user_type
(
self
)
!=
rms
.
enums_company
:
# elif rms.user_type(self) != rms.enums_super or rms.user_type(self) != rms.enums_company:
# raise ParseError(
# rms.access_error
# )
if
rms
.
user_type
(
self
)
!=
rms
.
enums_super
:
raise
ParseError
(
raise
ParseError
(
rms
.
access_error
rms
.
access_error
)
)
...
@@ -187,13 +190,12 @@ class rms:
...
@@ -187,13 +190,12 @@ class rms:
self
.
queryset
=
self
.
queryset
.
filter
(
self
.
queryset
=
self
.
queryset
.
filter
(
department
=
id
department
=
id
)
)
elif
rms
.
user_type
(
self
)
==
rms
.
enums_company
:
elif
rms
.
user_type
(
self
)
==
rms
.
enums_company
:
id
=
rms
.
user
(
self
)
.
department
.
company
.
id
id
=
rms
.
user
(
self
)
.
department
.
company
.
id
self
.
queryset
=
self
.
queryset
.
filter
(
self
.
queryset
=
self
.
queryset
.
filter
(
department__company
=
id
department__company
=
id
)
)
print
(
self
.
queryset
.
query
)
elif
rms
.
user_type
(
self
)
==
rms
.
enums_super
:
elif
rms
.
user_type
(
self
)
==
rms
.
enums_super
:
pass
pass
else
:
else
:
...
...
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