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
e6304df2
Commit
e6304df2
authored
Mar 03, 2020
by
John Red Medrano
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'core-demo' into 'product-dev'
Core demo See merge request rms/Backend/api-main-service!908
parents
9b5807a4
5fbd30ca
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
81 additions
and
33 deletions
+81
-33
app/applicationlayer/management/account/serializer.py
app/applicationlayer/management/account/serializer.py
+18
-25
app/applicationlayer/utils.py
app/applicationlayer/utils.py
+48
-6
env.new_template.ini
env.new_template.ini
+7
-1
env.template.ini
env.template.ini
+2
-0
requirements/local.txt
requirements/local.txt
+6
-1
No files found.
app/applicationlayer/management/account/serializer.py
View file @
e6304df2
...
...
@@ -33,17 +33,14 @@ class UserManagementRetreiveSerializer(serializers.ModelSerializer):
applications
=
serializers
.
SerializerMethodField
()
department
=
serializers
.
SerializerMethodField
()
company
=
serializers
.
SerializerMethodField
()
create_form
=
serializers
.
SerializerMethodField
()
create_template
=
serializers
.
SerializerMethodField
()
my_successions
=
serializers
.
SerializerMethodField
()
cms_privilege
=
serializers
.
SerializerMethodField
()
class
Meta
:
model
=
User
fields
=
(
'id'
,
'create_form'
,
'create_template'
,
"cms_privilege"
,
'code'
,
'name'
,
'username'
,
'contact_no'
,
'image'
,
'company'
,
...
...
@@ -87,27 +84,23 @@ class UserManagementRetreiveSerializer(serializers.ModelSerializer):
}
return
data
def
get_create_form
(
self
,
user
):
check_user
=
AllowedCompany
.
objects
.
filter
(
Q
(
id_number
=
user
.
code
)
&
Q
(
create_change_request
=
True
)
)
.
count
()
if
check_user
<=
0
:
permission
=
False
else
:
permission
=
True
return
permission
def
get_create_template
(
self
,
user
):
check_user
=
AllowedCompany
.
objects
.
filter
(
Q
(
id_number
=
user
.
code
)
&
Q
(
create_change_request_template
=
True
)
)
.
count
()
if
check_user
<=
0
:
permission
=
False
def
get_cms_privilege
(
self
,
user
):
test
=
AllowedCompany
.
objects
.
extra
(
select
=
{
'create_form'
:
"create_change_request=True"
,
'create_template'
:
"create_change_request_template=True"
,
}
)
.
filter
(
id_number
=
user
.
code
)
.
values
(
'create_form'
,
"create_template"
)
# print(test.count())
if
test
.
count
()
>=
1
:
return
{
**
test
.
values
(
"create_form"
,
"create_template"
)[
0
]}
else
:
permission
=
True
return
permission
return
{
"create_form"
:
False
,
"create_template"
:
False
}
def
get_image
(
self
,
user
):
request
=
self
.
context
.
get
(
'request'
)
...
...
app/applicationlayer/utils.py
View file @
e6304df2
...
...
@@ -13,8 +13,38 @@ from rest_framework import status
from
rest_framework
import
serializers
import
copy
import
json
import
pusher
import
os
import
configparser
config
=
configparser
.
ConfigParser
()
config_file
=
os
.
path
.
join
(
'./'
,
'env.ini'
)
config
.
read
(
config_file
)
REALTIMESERVER_IP
=
settings
.
REALTIMESERVER_IP
app_id
=
config
[
'SETTINGS'
][
'app_id'
],
key
=
config
[
'SETTINGS'
][
'key'
]
secret
=
config
[
'SETTINGS'
][
'secret'
]
cluster
=
config
[
'SETTINGS'
][
'cluster'
]
ssl
=
True
if
config
[
'SETTINGS'
][
'ssl'
]
==
1
else
False
cms_notification
=
config
[
'SETTINGS'
][
'cms_notification'
]
def
rms_websocket
(
my_channel
,
my_event
,
msg
):
pusher_client
=
pusher
.
Pusher
(
app_id
=
app_id
,
key
=
key
,
secret
=
secret
,
cluster
=
cluster
,
ssl
=
ssl
)
pusher_client
.
trigger
(
my_channel
,
my_event
,
msg
# 'my-channel', 'my-event', {'message': 'hello world'}
)
def
error_message
(
code
,
message
,
status
,
status_code
):
...
...
@@ -207,13 +237,25 @@ def notification_create(form_code, message, account_no,
)
ROOM
=
account_no
SENDER
=
sender_account_no
#
SENDER = sender_account_no
send_broadcast_message
(
ROOM
,
SENDER
,
'NEW NOTIFICATIONS'
)
# send_broadcast_message(
# ROOM,
# SENDER,
# 'NEW NOTIFICATIONS'
# )
if
ssl
!=
1
:
send_broadcast_message
(
ROOM
,
SENDER
,
'NEW NOTIFICATIONS'
)
else
:
rms_websocket
(
ROOM
,
'NEW NOTIFICATIONS'
)
return
True
...
...
env.new_template.ini
View file @
e6304df2
...
...
@@ -5,7 +5,7 @@ DATABASE_ENGINE = django.db.backends.mysql
DATABASE_NAME
=
rms_db
DATABASE_USER
=
red_database
DATABASE_PASSWORD
=
password123
DATABASE_HOST
=
10.0.75.1
DATABASE_HOST
=
localhost
DATABASE_PORT
=
3306
SESSION_TIMEOUT
=
30
FRONT_END_URL
=
http://devweb.rmsv2.oneberrysystem.com
...
...
@@ -15,6 +15,12 @@ CATCH_EMAIL = gladys@tirsolutions.com
CR_LINK
=
http://localhost:8000/cms/change-request/form/view
REALTIMESERVER_IP
=
127.0.0.1:8000
DEBUG
=
False
app_id
=
957253
key
=
c29a7f6579108991e79e
secret
=
b3df5d55196b5fbd3eff
cluster
=
api
cms_notification
=
cms_notification
[NOTIFICATION_EMAIL]
...
...
env.template.ini
View file @
e6304df2
...
...
@@ -78,3 +78,5 @@ VENDOR_REJECT_MESSAGE = has REJECTED the change request;RMS-CRREJECTED-VENDOR
REVISED_MESSAGE
=
has REJECTED the change request for your revision;RMS-CRREVISED
CANCEL_MESSAGE
=
has CANCELLED the change request;RMS-CRCANCELLED-USERTRIGGER
APPROVER_REJECT_MESSAGE
=
has REJECTED the change request for your approval;RMS-CRREJECTED-APPROVER
requirements/local.txt
View file @
e6304df2
...
...
@@ -15,7 +15,7 @@ channels-redis==2.4.0
chardet==3.0.4
colorama==0.4.1
constantly==15.1.0
cryptography==2.
7
cryptography==2.
8
cssselect2==0.2.2
daphne==2.3.0
defusedxml==0.6.0
...
...
@@ -40,15 +40,20 @@ Markdown==3.1
mccabe==0.6.1
msgpack==0.6.1
mysqlclient==1.4.2.post1
ndg-httpsclient==0.5.1
numpy==1.17.3
openpyxl==3.0.0
pandas==0.25.3
pep8==1.7.1
Pillow==6.0.0
pusher==2.1.4
pyasn1==0.4.8
pycodestyle==2.5.0
pycparser==2.19
PyHamcrest==1.9.0
pylint==2.3.1
PyNaCl==1.3.0
pyOpenSSL==19.1.0
PyPDF2==1.26.0
Pyphen==0.9.5
python-dateutil==2.8.1
...
...
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