Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
scc-net-wlan
ap-liste
netvs-middleware
Commits
fcb9b2e5
Commit
fcb9b2e5
authored
Jul 08, 2021
by
janis.streib
🦉
Browse files
ADD: auth
parent
adee9f3f
Changes
1
Hide whitespace changes
Inline
Side-by-side
views.py
View file @
fcb9b2e5
import
requests
from
net_suite
import
app
from
flask
import
jsonify
from
net_suite.views
import
api_login_required
from
.
import
apliste
@
apliste
.
route
(
"/json"
,
methods
=
[
"GET"
])
@
api_login_required
def
get_data
():
user
=
request
.
environ
[
'beaker.session'
][
'login'
]
if
not
user
.
has_permission
(
'nd.global_reader'
):
return
abort
(
400
)
data
=
requests
.
get
(
'{url}/json'
.
format
(
url
=
app
.
config
.
get
(
'APLISTE_SERVER_URL'
)),
cert
=
(
app
.
config
.
get
(
'APLISTE_CERT'
),
app
.
config
.
get
(
'APLISTE_KEY'
))).
json
()
return
jsonify
(
data
)
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