Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-django-backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
Container 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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-django-backend
Commits
c65eee53
Verified
Commit
c65eee53
authored
Nov 26, 2020
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
WIP: authentication
parent
34d3ff3c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
djaosdb/caosdb_client.py
+14
-3
14 additions, 3 deletions
djaosdb/caosdb_client.py
with
14 additions
and
3 deletions
djaosdb/caosdb_client.py
+
14
−
3
View file @
c65eee53
...
@@ -186,9 +186,14 @@ class DefaultCaosDBClientDelegate:
...
@@ -186,9 +186,14 @@ class DefaultCaosDBClientDelegate:
def
find_auth
(
self
,
record_type
,
*
args
,
**
kwargs
):
def
find_auth
(
self
,
record_type
,
*
args
,
**
kwargs
):
if
record_type
==
"
caosdb_auth_user
"
:
if
record_type
==
"
caosdb_auth_user
"
:
name
=
kwargs
[
"
filter
"
][
"
elements
"
][
-
1
][
"
v
"
]
name
=
kwargs
[
"
filter
"
][
"
elements
"
][
-
1
][
"
v
"
]
print
(
"
find
"
+
name
)
res
=
self
.
_caosdb
.
administration
.
_retrieve_user
(
name
)
res
=
self
.
_caosdb
.
administration
.
_retrieve_user
(
name
)
print
(
res
)
columns
=
[
"
id
"
,
"
password
"
,
"
last_login
"
,
"
is_superuser
"
,
"
username
"
,
"
first_name
"
,
"
last_name
"
,
"
email
"
,
"
is_staff
"
,
"
is_active
"
,
"
date_joined
"
]
rows
=
[(
0
,
None
,
None
,
True
,
"
tf
"
,
"
t
"
,
"
f
"
,
"
tf@example.com
"
,
True
,
True
,
None
,)]
return
FindResult
(
rows
,
columns
)
return
FindResult
([],
[])
def
list_record_type_names
(
self
):
def
list_record_type_names
(
self
):
res
=
self
.
_caosdb
.
execute_query
(
"
SELECT name FROM RECORDTYPE
"
)
res
=
self
.
_caosdb
.
execute_query
(
"
SELECT name FROM RECORDTYPE
"
)
...
@@ -246,6 +251,9 @@ class DefaultCaosDBClientDelegate:
...
@@ -246,6 +251,9 @@ class DefaultCaosDBClientDelegate:
c
.
insert
(
unique
=
False
)
c
.
insert
(
unique
=
False
)
return
InsertManyResult
(
c
)
return
InsertManyResult
(
c
)
def
update_many_auth
(
self
,
record_type
:
str
,
filter
,
update
):
return
UpdateManyResult
([
1
])
def
update_many
(
self
,
record_type
:
str
,
filter
,
update
):
def
update_many
(
self
,
record_type
:
str
,
filter
,
update
):
res
=
self
.
_find
(
record_type
,
filter
=
filter
)
res
=
self
.
_find
(
record_type
,
filter
=
filter
)
update_set
=
update
[
"
$set
"
]
update_set
=
update
[
"
$set
"
]
...
@@ -256,6 +264,7 @@ class DefaultCaosDBClientDelegate:
...
@@ -256,6 +264,7 @@ class DefaultCaosDBClientDelegate:
if
hasattr
(
val
,
"
isoformat
"
):
if
hasattr
(
val
,
"
isoformat
"
):
val
=
val
.
isoformat
()
val
=
val
.
isoformat
()
e
.
get_property
(
p
).
value
=
val
e
.
get_property
(
p
).
value
=
val
if
res
:
res
.
update
()
res
.
update
()
return
UpdateManyResult
(
res
)
return
UpdateManyResult
(
res
)
...
@@ -432,6 +441,8 @@ class CaosDBClient:
...
@@ -432,6 +441,8 @@ class CaosDBClient:
-------
-------
"""
"""
LOGGER
.
debug
(
"
update_many(%s, %s)
"
,
args
,
kwargs
)
LOGGER
.
debug
(
"
update_many(%s, %s)
"
,
args
,
kwargs
)
if
args
[
0
].
startswith
(
"
caosdb_auth_
"
):
return
self
.
_delegate
.
update_many_auth
(
*
args
,
**
kwargs
)
return
self
.
_delegate
.
update_many
(
*
args
,
**
kwargs
)
return
self
.
_delegate
.
update_many
(
*
args
,
**
kwargs
)
def
drop_record_type
(
self
,
*
args
,
**
kwargs
):
def
drop_record_type
(
self
,
*
args
,
**
kwargs
):
...
...
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