Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-pylib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-pylib
Commits
2e8e2ce9
Unverified
Commit
2e8e2ce9
authored
6 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Plain Diff
Merge branch 'f-server-side-scripting' into f-anonymous-user
parents
50a24b3a
cfb0de7e
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+2
-0
2 additions, 0 deletions
README.md
src/caosdb/common/administration.py
+7
-4
7 additions, 4 deletions
src/caosdb/common/administration.py
src/caosdb/exceptions.py
+4
-3
4 additions, 3 deletions
src/caosdb/exceptions.py
with
13 additions
and
7 deletions
README.md
+
2
−
0
View file @
2e8e2ce9
<!--THIS FILE HAS BEEN GENERATED BY A SCRIPT. PLEASE DON'T CHANGE IT MANUALLY.-->
# Welcome
This is the
**CaosDB Python Client Library**
repository and a part of the
...
...
This diff is collapsed.
Click to expand it.
src/caosdb/common/administration.py
+
7
−
4
View file @
2e8e2ce9
...
...
@@ -219,6 +219,7 @@ def _delete_role(name, **kwargs):
def
_set_roles
(
username
,
roles
,
realm
=
None
,
**
kwargs
):
xml
=
etree
.
Element
(
"
Roles
"
)
print
(
roles
)
for
r
in
roles
:
xml
.
append
(
etree
.
Element
(
"
Role
"
,
name
=
r
))
...
...
@@ -254,8 +255,9 @@ def _get_roles(username, realm=None, **kwargs):
e
.
msg
=
"
User does not exist.
"
raise
ret
=
set
()
for
r
in
etree
.
fromstring
(
body
)[
0
]:
ret
.
add
(
r
.
get
(
"
name
"
))
for
r
in
etree
.
fromstring
(
body
).
xpath
(
'
/Response/Roles
'
)[
0
]:
if
r
.
tag
==
"
Role
"
:
ret
.
add
(
r
.
get
(
"
name
"
))
return
ret
...
...
@@ -316,11 +318,12 @@ class PermissionRule():
xml
=
etree
.
fromstring
(
body
)
ret
=
set
()
for
c
in
xml
:
ret
.
add
(
PermissionRule
.
_parse_element
(
c
))
if
c
.
tag
in
[
"
Grant
"
,
"
Deny
"
]:
ret
.
add
(
PermissionRule
.
_parse_element
(
c
))
return
ret
def
__str__
(
self
):
return
self
.
_action
+
"
(
"
+
self
.
_permission
+
"
)
"
+
\
return
str
(
self
.
_action
)
+
"
(
"
+
str
(
self
.
_permission
)
+
"
)
"
+
\
(
"
P
"
if
self
.
_priority
is
True
else
""
)
def
__repr__
(
self
):
...
...
This diff is collapsed.
Click to expand it.
src/caosdb/exceptions.py
+
4
−
3
View file @
2e8e2ce9
...
...
@@ -70,9 +70,10 @@ class ClientErrorException(CaosDBException):
class
ServerErrorException
(
CaosDBException
):
def
__init__
(
self
,
body
):
xml
=
etree
.
fromstring
(
body
)
msg
=
xml
[
0
].
get
(
"
description
"
)
if
xml
[
0
].
text
is
not
None
:
msg
=
msg
+
"
\n\n
"
+
xml
[
0
].
text
error
=
xml
.
xpath
(
'
/Response/Error
'
)[
0
]
msg
=
error
.
get
(
"
description
"
)
if
error
.
text
is
not
None
:
msg
=
msg
+
"
\n\n
"
+
error
.
text
CaosDBException
.
__init__
(
self
,
msg
)
...
...
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