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
5915d68e
Commit
5915d68e
authored
Sep 09, 2019
by
Gladys Forte
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'RMSv2' of
http://42.61.118.105:7990/scm/rms/api-main-service
into gladys-dev2
parents
35ff9419
0e0e4c70
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
17 deletions
+43
-17
app/applicationlayer/management/user/serializers.py
app/applicationlayer/management/user/serializers.py
+26
-16
app/entities/migrations/0002_remove_application_app_code.py
app/entities/migrations/0002_remove_application_app_code.py
+17
-0
app/entities/models.py
app/entities/models.py
+0
-1
No files found.
app/applicationlayer/management/user/serializers.py
View file @
5915d68e
...
@@ -39,29 +39,39 @@ class UserManagementRoleSerializer(serializers.ModelSerializer):
...
@@ -39,29 +39,39 @@ class UserManagementRoleSerializer(serializers.ModelSerializer):
class
UserManagementRetreiveSerializer
(
serializers
.
ModelSerializer
):
class
UserManagementRetreiveSerializer
(
serializers
.
ModelSerializer
):
image
=
serializers
.
SerializerMethodField
()
image
=
serializers
.
SerializerMethodField
()
applications
=
serializers
.
SerializerMethodField
()
applications
=
serializers
.
SerializerMethodField
()
department_name
=
serializers
.
ReadOnlyField
(
source
=
'department.name'
)
department
=
serializers
.
SerializerMethodField
()
department_id
=
serializers
.
ReadOnlyField
(
source
=
'department.id'
)
company
=
serializers
.
SerializerMethodField
()
# role = UserManagementRoleSerializer()
# special_permissions = serializers.SlugRelatedField(many=True,
# read_only=True,
# slug_field='code')
class
Meta
:
class
Meta
:
model
=
models
.
User
model
=
models
.
User
fields
=
(
fields
=
(
'id'
,
'image'
,
'applications'
,
'id'
,
'last_login'
,
'is_superuser'
,
'first_name'
,
'last_name'
,
'is_staff'
,
'is_active'
,
'date_joined'
,
'user_type'
,
'code'
,
'name'
,
'code'
,
'name'
,
'username'
,
'contact_no'
,
'username'
,
'contact_no'
,
'email'
,
'department_name'
,
'image'
,
'company'
,
'doa'
,
'department_id'
,
'department'
,
'applications'
,
'default_app'
,
'email'
,
'default_app'
,
'user_type'
,
'is_active'
,
'doa'
,
)
)
# exclude = ['password', 'application', 'groups', 'user_permissions']
# exclude = ['password', 'application', 'groups', 'user_permissions']
def
get_department
(
self
,
user
):
data
=
{
"id"
:
user
.
department
.
id
,
"name"
:
user
.
department
.
name
}
return
data
def
get_company
(
self
,
user
):
data
=
{
"id"
:
user
.
department
.
company
.
id
,
"name"
:
user
.
department
.
company
.
name
}
return
data
def
get_image
(
self
,
user
):
def
get_image
(
self
,
user
):
request
=
self
.
context
.
get
(
'request'
)
request
=
self
.
context
.
get
(
'request'
)
...
@@ -76,7 +86,7 @@ class UserManagementRetreiveSerializer(serializers.ModelSerializer):
...
@@ -76,7 +86,7 @@ class UserManagementRetreiveSerializer(serializers.ModelSerializer):
app
=
user
.
application
.
all
()
app
=
user
.
application
.
all
()
list_app
=
[]
list_app
=
[]
for
data
in
app
:
for
data
in
app
:
if
user
.
user_type
.
upper
()
==
'USR'
and
data
.
app_code
.
upper
()
==
'RMS'
:
if
user
.
user_type
.
upper
()
==
'USR'
and
data
.
id
==
1
:
pass
pass
else
:
else
:
remove
=
[
'Modules'
,
'Companies'
,
'Department'
]
remove
=
[
'Modules'
,
'Companies'
,
'Department'
]
...
@@ -102,7 +112,7 @@ class UserManagementRetreiveSerializer(serializers.ModelSerializer):
...
@@ -102,7 +112,7 @@ class UserManagementRetreiveSerializer(serializers.ModelSerializer):
# list_mod.append(body)
# list_mod.append(body)
app_body
=
{}
app_body
=
{}
app_body
[
'app_code'
]
=
data
.
app_
code
app_body
[
'app_code'
]
=
data
.
code
app_body
[
'name'
]
=
data
.
name
app_body
[
'name'
]
=
data
.
name
app_body
[
'modules'
]
=
mod
app_body
[
'modules'
]
=
mod
list_app
.
append
(
app_body
)
list_app
.
append
(
app_body
)
...
...
app/entities/migrations/0002_remove_application_app_code.py
0 → 100644
View file @
5915d68e
# Generated by Django 2.2 on 2019-09-09 17:14
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'entities'
,
'0001_initial'
),
]
operations
=
[
migrations
.
RemoveField
(
model_name
=
'application'
,
name
=
'app_code'
,
),
]
app/entities/models.py
View file @
5915d68e
...
@@ -26,7 +26,6 @@ class Application(AuditClass):
...
@@ -26,7 +26,6 @@ class Application(AuditClass):
max_length
=
255
max_length
=
255
)
)
name
=
models
.
CharField
(
unique
=
True
,
max_length
=
255
)
name
=
models
.
CharField
(
unique
=
True
,
max_length
=
255
)
app_code
=
models
.
CharField
(
max_length
=
255
)
class
Meta
:
class
Meta
:
db_table
=
'applications'
db_table
=
'applications'
...
...
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