Creating Topics during PostLoginListener

In a DM4 world I had the following functionality:
During postlogin I would create a user topic (domain model of the app, not the DM user types). Later it would create a workspace for this user and make the formerly create domain model user part of the workspace by assigning it. This was done through the workspace service.

In DMX world this fails for many reasons the first being:

I cant get the user creation to work. I assume this used to be a situation without explicit workspace assignment in DM4. In DMX I tried to create the user using all kinds of workspace assignments (during creation) but none would be OK because I get this error:

WARNING: Object 24194 (typeUri=dmx.workspaces.workspace_assignment) is not assigned to any workspace – WRITE permission is refused
(typeUri=“dmx.workspaces.workspace_assignment”) to workspace 24178 failed

dmx.workspaces.workspace_assignment is not under my control, so I cant do anything about it not being part of any workspace.

How am I supposed to create that user and in what workspace?

In DMX you can’t use the WorkspacesService’s assignToWorkspace() to do the initial workspace assignment due to higher security in DMX. Use privileged access instead:

dmx.getPrivilegedAccess().assignToWorkspace(object, workspaceId);

See also the apidocs.

This warning appears if object permissions are queried, and that object has no workspace assignment. In this case the object is treated as READable, but not WRITEable.

So its just a warning about a possible missing workspace assignment, not an error about a failed WRITE attempt.

The warning text should be improved.

Note that objects w/o workspace assignment is still valid state. In your case the WARNING is about an association of type “Workspace Assignment”. Workspace Assignments don’t have workspace assignments.