Skip to content

Commit

Permalink
dbio: get owner reassignment to work with standalone midasserver
Browse files Browse the repository at this point in the history
  • Loading branch information
RayPlante committed Nov 27, 2024
1 parent 4c22476 commit e4e2a01
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docker/midasserver/midas-dmpdapnsd_conf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ logfile: midas.log
loglevel: DEBUG
dbio:
factory: fsbased
people_service:
factory: mongo
db_url: "mongodb://oarop:oarop@mongodb:27017/midas"
about:
title: "MIDAS Authoring Services"
describedBy: "http://localhost:9091/midas/docs"
Expand Down
5 changes: 4 additions & 1 deletion python/nistoar/midas/dbio/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,17 @@ def create_record(self, name, data=None, meta=None) -> ProjectRecord:
foruser = foruser[-1]

if self.dbcli.user_id == ANONYMOUS:
foruser = None
# Do we need to be more careful in production by cancelling reassign request?
# foruser = None
self.log.warning("A new record requested for an anonymous user")

prec = self.dbcli.create_record(name, shoulder)
self._set_default_perms(prec.acls)

prec.status._data["created_by"] = self.who.id # don't do this: violates encapsulation
if foruser:
if self.dbcli.user_id == ANONYMOUS:
self.log.warning("%s wants to reassign new record to %s", self.dbcli.user_id, foruser)
try:
prec.reassign(foruser)
except NotAuthorized as ex:
Expand Down

0 comments on commit e4e2a01

Please sign in to comment.