From 41e77ef2f1ce87fcd7ee0af45a5caa70387858b7 Mon Sep 17 00:00:00 2001 From: visi Date: Fri, 18 Oct 2024 13:48:38 -0400 Subject: [PATCH] wip --- synapse/models/doc.py | 24 +++++++++++++++++++----- synapse/models/orgs.py | 3 +++ synapse/tests/test_model_orgs.py | 3 +++ 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/synapse/models/doc.py b/synapse/models/doc.py index 4145de8130..dc2a10ed5c 100644 --- a/synapse/models/doc.py +++ b/synapse/models/doc.py @@ -7,7 +7,12 @@ def getModelDefs(self): return (('doc', { 'interfaces': ( ('doc:document', { - 'template': {'document': 'document'}, + + 'template': { + 'type': 'NEWP', + 'document': 'document', + 'documents': 'documents'}, + 'props': ( ('id', ('str', {'strip': True}), { @@ -16,6 +21,9 @@ def getModelDefs(self): ('name', ('str', {'lower': True, 'onespace': True}), { 'doc': 'The {document} name.'}), + ('type', ('{type}', {}), { + 'doc': 'The type of {document}.'}), + ('text', ('str', {}), { 'doc': 'The text of the {document}.'}), @@ -32,13 +40,13 @@ def getModelDefs(self): 'doc': 'The contact information of the primary author.'}), ('contributors', ('array', {'type': 'ps:contact', 'sorted': True, 'uniq': True}), { - 'doc': 'An array of contacts which contributed to the {document}'}), + 'doc': 'An array of contacts which contributed to the {document}.'}), ('version', ('it:semver', {}), { 'doc': 'The version of the {document}.'}), ('supersedes', ('array', {'type': '$self', 'sorted': True, 'uniq': True}), { - 'doc': 'An array of {document}s which are superseded by this {document}.'}), + 'doc': 'An array of {documents} which are superseded by this {document}.'}), ), }), ), @@ -50,7 +58,10 @@ def getModelDefs(self): ('doc:policy', ('guid', {}), { 'interfaces': ('doc:document',), - 'template': {'document': 'policy'}, + 'template': { + 'document': 'policy', + 'documents': 'policies', + 'type': 'doc:policy:type:taxonomy'}, 'doc': 'Guiding principles used to reach a set of goals.'}), ('doc:standard:type:taxonomy', ('taxonomy', {}), { @@ -59,7 +70,10 @@ def getModelDefs(self): ('doc:standard', ('guid', {}), { 'interfaces': ('doc:document',), - 'template': {'document': 'standard'}, + 'template': { + 'document': 'standard', + 'documents': 'standards', + 'type': 'doc:standard:type:taxonomy'}, 'doc': 'A group of requirements which define how to implement a policy or goal.'}), ), 'forms': ( diff --git a/synapse/models/orgs.py b/synapse/models/orgs.py index 3cbe617fea..144cec9e34 100644 --- a/synapse/models/orgs.py +++ b/synapse/models/orgs.py @@ -1299,6 +1299,9 @@ def getModelDefs(self): ('doc', ('ndef', {'forms': ('doc:policy', 'doc:standard')}), { 'doc': 'The document enacted by the organization.'}), + + ('scope', ('ndef', {}), { + 'doc': 'The scope of responsbility for the assignee to enact the document.'}), )), ('ou:requirement:type:taxonomy', {}, ()), diff --git a/synapse/tests/test_model_orgs.py b/synapse/tests/test_model_orgs.py index d95f278d84..f5f6cd56dd 100644 --- a/synapse/tests/test_model_orgs.py +++ b/synapse/tests/test_model_orgs.py @@ -715,6 +715,7 @@ async def test_ou_simple(self): :completed=20241018 :creator=root :assignee=visi + :scope=(ou:team, *) :ext:creator={[ ps:contact=* :name=root ]} :ext:assignee={[ ps:contact=* :name=visi ]} ] @@ -732,10 +733,12 @@ async def test_ou_simple(self): self.eq(visi.iden, nodes[0].get('assignee')) self.eq(core.auth.rootuser.iden, nodes[0].get('creator')) + self.nn(nodes[0].get('scope')) self.nn(nodes[0].get('ext:creator')) self.nn(nodes[0].get('ext:assignee')) self.len(1, await core.nodes('ou:enacted -> proj:project')) + self.len(1, await core.nodes('ou:enacted :scope -> ou:team')) self.len(1, await core.nodes('ou:enacted :ext:creator -> ps:contact +:name=root')) self.len(1, await core.nodes('ou:enacted :ext:assignee -> ps:contact +:name=visi'))