Shared config topics get multiple workspace assignments
When creating a user account the ConfigService
attaches config topics to the Username topic, e.g. "Enabled Sharing Modes". Config topics get special workspace assignments. In DM5 config topics are shared between accounts. So when a new user account is created the config topics might not be created (but shared). However the special workspace assignment is still done. The ConfigService does not use the WorkspacesService
to perform the workspace assignment (but a privileged Core operation *). As a result the config topics gets multiple workspace assignments -- one more with every account created.
In DMX 5.0-beta-3 the multiple workspace assignments were not a problem.
But in current 5.0-beta-4-SNAPSHOT the association duplicate check is fixed (#237 (closed)). As a consequence multiple workspace assignments are now properly detected. A "Duplicate Exception" is thrown and the entire create-user-account transaction is rolled back (see stacktrace below).
In current 5.0-beta-4-SNAPSHOT creating user accounts does not work at all anymore. Not for admins, not for anyone (see also #238 (closed)).
*) The WorkspacesService consumes the ConfigService, so the ConfigService can't consume the WorkspacesService as this would be a circular dependency.
Jun 21, 2019 2:19:00 AM systems.dmx.accesscontrol.AccessControlPlugin createUserAccount
INFO: Creating user account "jri"
Jun 21, 2019 2:19:00 AM systems.dmx.accesscontrol.AccessControlPlugin createUsername
INFO: Creating username topic "jri"
Jun 21, 2019 2:19:00 AM systems.dmx.config.ConfigPlugin _createConfigTopic
INFO: ### Creating config topic of type "dmx.workspaces.enabled_sharing_modes" for topic 453
Jun 21, 2019 2:19:01 AM systems.dmx.core.util.UniversalExceptionMapper logException
SEVERE: Request "POST /accesscontrol/user_account" failed. Responding with 500 (Internal Server Error). The original exception/error is:
java.lang.RuntimeException: Creating user account "jri" failed
at systems.dmx.accesscontrol.AccessControlPlugin.createUserAccount(AccessControlPlugin.java:260)
...
Caused by: java.lang.RuntimeException: Creating username topic "jri" failed
at systems.dmx.accesscontrol.AccessControlPlugin.createUsername(AccessControlPlugin.java:304)
at systems.dmx.accesscontrol.AccessControlPlugin.createUserAccount(AccessControlPlugin.java:237)
... 51 more
Caused by: java.lang.RuntimeException: Creating topic failed, model=TopicModelImpl {
"id": -1,
"uri": "",
"typeUri": "dmx.accesscontrol.username",
"value": "jri",
"children": {}
}
at systems.dmx.core.impl.PersistenceLayer.createTopic(PersistenceLayer.java:133)
at systems.dmx.core.impl.CoreServiceImpl.createTopic(CoreServiceImpl.java:117)
at systems.dmx.core.impl.CoreServiceImpl.createTopic(CoreServiceImpl.java:31)
at systems.dmx.accesscontrol.AccessControlPlugin$4.call(AccessControlPlugin.java:284)
at systems.dmx.accesscontrol.AccessControlPlugin$4.call(AccessControlPlugin.java:281)
at systems.dmx.core.util.ContextTracker.run(ContextTracker.java:24)
at systems.dmx.core.impl.AccessControlImpl.runWithoutWorkspaceAssignment(AccessControlImpl.java:357)
at systems.dmx.accesscontrol.AccessControlPlugin.createUsername(AccessControlPlugin.java:281)
... 52 more
Caused by: java.lang.RuntimeException: Value integration failed, newValues=TopicModelImpl {
"id": -1,
"uri": "",
"typeUri": "dmx.accesscontrol.username",
"value": "jri",
"children": {}
}, targetObject=null, compDef=null
at systems.dmx.core.impl.ValueIntegrator.integrate(ValueIntegrator.java:111)
at systems.dmx.core.impl.PersistenceLayer.updateValues(PersistenceLayer.java:892)
at systems.dmx.core.impl.PersistenceLayer.createTopic(PersistenceLayer.java:131)
... 59 more
Caused by: java.lang.RuntimeException: Creating single topic failed, model=TopicModelImpl {
"id": 453,
"uri": "",
"typeUri": "dmx.accesscontrol.username",
"value": "jri",
"children": {}
}, uriPrefix="null"
at systems.dmx.core.impl.PersistenceLayer.createSingleTopic(PersistenceLayer.java:178)
at systems.dmx.core.impl.PersistenceLayer.createSingleTopic(PersistenceLayer.java:141)
at systems.dmx.core.impl.ValueIntegrator.createSimpleTopic(ValueIntegrator.java:739)
at systems.dmx.core.impl.ValueIntegrator.unifySimple(ValueIntegrator.java:208)
at systems.dmx.core.impl.ValueIntegrator.integrateSimple(ValueIntegrator.java:171)
at systems.dmx.core.impl.ValueIntegrator.integrate(ValueIntegrator.java:102)
... 61 more
Caused by: java.lang.RuntimeException: An error occurred in the PostCreateTopic of plugin "DMX Config"
at systems.dmx.core.impl.EventManager.dispatchEvent(EventManager.java:96)
at systems.dmx.core.impl.EventManager.fireEvent(EventManager.java:59)
at systems.dmx.core.impl.PersistenceLayer.createSingleTopic(PersistenceLayer.java:174)
... 66 more
Caused by: java.lang.RuntimeException: Creating config topic of type "dmx.workspaces.enabled_sharing_modes" for topic 453 failed
at systems.dmx.config.ConfigPlugin._createConfigTopic(ConfigPlugin.java:170)
at systems.dmx.config.ConfigPlugin.postCreateTopic(ConfigPlugin.java:139)
at systems.dmx.core.impl.CoreEvent$9.dispatch(CoreEvent.java:113)
at systems.dmx.core.impl.EventManager.dispatchEvent(EventManager.java:83)
... 68 more
Caused by: java.lang.RuntimeException: Assigning object 2345 to workspace 2307 failed, object=RelatedTopicModelImpl {
"id": 2345,
"uri": "",
"typeUri": "dmx.workspaces.enabled_sharing_modes",
"value": "true true true true true",
"children": ...,
"assoc": ...
}
at systems.dmx.core.impl.AccessControlImpl.assignToWorkspace(AccessControlImpl.java:348)
at systems.dmx.config.ConfigPlugin$1.call(ConfigPlugin.java:163)
at systems.dmx.config.ConfigPlugin$1.call(ConfigPlugin.java:155)
at systems.dmx.core.util.ContextTracker.run(ContextTracker.java:24)
at systems.dmx.core.impl.AccessControlImpl.runWithoutWorkspaceAssignment(AccessControlImpl.java:357)
at systems.dmx.config.ConfigPlugin._createConfigTopic(ConfigPlugin.java:155)
... 71 more
Caused by: java.lang.RuntimeException: Creating association failed, model=AssocModelImpl {
"id": -1,
"uri": "",
"typeUri": "dmx.workspaces.workspace_assignment",
"value": "",
"children": {},
"player1": {
"topicId": 2345,
"roleTypeUri": "dmx.core.parent"
},
"player2": {
"topicId": 2307,
"roleTypeUri": "dmx.core.child"
}
}
at systems.dmx.core.impl.PersistenceLayer.createAssoc(PersistenceLayer.java:374)
at systems.dmx.core.impl.PersistenceLayer.createAssoc(PersistenceLayer.java:342)
at systems.dmx.core.impl.AccessControlImpl.assignToWorkspace(AccessControlImpl.java:341)
... 76 more
Caused by: java.lang.RuntimeException: Duplicate: such an association exists already, AssocModelImpl {
"id": -1,
"uri": "",
"typeUri": "dmx.workspaces.workspace_assignment",
"value": "",
"children": {},
"player1": {
"topicId": 2345,
"roleTypeUri": "dmx.core.parent"
},
"player2": {
"topicId": 2307,
"roleTypeUri": "dmx.core.child"
}
}, existing assoc=AssocModelImpl {
"id": 2360,
"uri": "",
"typeUri": "dmx.workspaces.workspace_assignment",
"value": "",
"children": {},
"player1": {
"topicId": 2307,
"roleTypeUri": "dmx.core.child"
},
"player2": {
"topicId": 2345,
"roleTypeUri": "dmx.core.parent"
}
}
at systems.dmx.core.impl.AssocModelImpl.duplicateCheck(AssocModelImpl.java:397)
at systems.dmx.core.impl.AssocModelImpl.preCreate(AssocModelImpl.java:301)
at systems.dmx.core.impl.PersistenceLayer.createAssoc(PersistenceLayer.java:352)
... 78 more
Jun 21, 2019 2:19:01 AM systems.dmx.core.impl.TransactionFactory$TransactionResourceFilter$2 filter
WARNING: ### Rollback transaction of systems.dmx.accesscontrol.AccessControlPlugin#createUserAccount()