Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dm-docs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hammonds
dm-docs
Commits
688b85d9
Commit
688b85d9
authored
9 years ago
by
sveseli
Browse files
Options
Downloads
Patches
Plain Diff
fix unauthorized string error in login controller
parent
aff629ba
No related branches found
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/python/dm/common/service/loginController.py
+12
-11
12 additions, 11 deletions
src/python/dm/common/service/loginController.py
with
12 additions
and
11 deletions
src/python/dm/common/service/loginController.py
+
12
−
11
View file @
688b85d9
...
@@ -170,19 +170,20 @@ class LoginController(DmController):
...
@@ -170,19 +170,20 @@ class LoginController(DmController):
raise
DmHttpError
(
dmHttpStatus
.
DM_HTTP_UNAUTHORIZED
,
'
User Not Authorized
'
,
InvalidSession
(
errorMsg
))
raise
DmHttpError
(
dmHttpStatus
.
DM_HTTP_UNAUTHORIZED
,
'
User Not Authorized
'
,
InvalidSession
(
errorMsg
))
username
=
sessionInfo
.
get
(
LoginController
.
SESSION_USERNAME_KEY
)
username
=
sessionInfo
.
get
(
LoginController
.
SESSION_USERNAME_KEY
)
if
not
username
:
errorMsg
=
'
Invalid session id: %s (no username supplied).
'
%
sessionId
logger
.
debug
(
errorMsg
)
raise
DmHttpError
(
dmHttpStatus
.
DM_HTTP_UNAUTHORIZED
,
'
User Not Authorized
'
,
InvalidSession
(
errorMsg
))
cherrypy
.
session
[
LoginController
.
SESSION_ROLE_KEY
]
=
sessionInfo
[
LoginController
.
SESSION_ROLE_KEY
]
cherrypy
.
session
[
LoginController
.
SESSION_ROLE_KEY
]
=
sessionInfo
[
LoginController
.
SESSION_ROLE_KEY
]
logger
.
debug
(
'
Session id %s is valid (username: %s)
'
%
(
sessionId
,
username
))
logger
.
debug
(
'
Session id %s is valid (username: %s)
'
%
(
sessionId
,
username
))
if
username
:
cherrypy
.
request
.
login
=
username
cherrypy
.
request
.
login
=
username
for
condition
in
conditions
:
for
condition
in
conditions
:
# A condition is just a callable that returns true or false
# A condition is just a callable that returns true or false
if
not
condition
():
if
not
condition
():
logger
.
debug
(
'
Authorization check %s() failed for username %s
'
%
(
condition
.
func_name
,
username
))
logger
.
debug
(
'
Authorization check %s() failed for username %s
'
%
(
condition
.
func_name
,
username
))
errorMsg
=
'
Authorization check %s() failed for user %s.
'
%
(
condition
.
func_name
,
username
)
errorMsg
=
'
Authorization check %s() failed for user %s.
'
%
(
condition
.
func_name
,
username
)
raise
DmHttpError
(
dmHttpStatus
.
DM_HTTP_UNAUTHORIZED
,
'
User Not Authorized
'
,
AuthorizationError
(
errorMsg
))
raise
DmHttpError
(
dmHttpStatus
.
DM_HTTP_UNAUTHORIZED
,
'
User Not Authorized
'
,
AuthorizationError
(
errorMsg
))
else
:
logger
.
debug
(
'
Username is not supplied
'
)
raise
DmHttpError
(
dmHttpStatus
.
DM_HTTP_UNAUTHORIZED
,
'
User Not Authorized
'
,
ex
)
@cherrypy.expose
@cherrypy.expose
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment