[PATCH 1 of 4 saem_ref] [seda] Make "ark_naa" relation from SEDAArchiveUnit non-required

Denis Laxalde denis.laxalde at logilab.fr
Mon May 14 17:30:55 CEST 2018


# HG changeset patch
# User Denis Laxalde <denis.laxalde at logilab.fr>
# Date 1526304502 -7200
#      Mon May 14 15:28:22 2018 +0200
# Node ID 4848e8a4afadb47294a271b72aaadb54890ddd2c
# Parent  d5098b706565f0631f00d6d6c637f999085dcc0b
# Available At http://hg.logilab.org/review/cubes/saem_ref
#              hg pull http://hg.logilab.org/review/cubes/saem_ref -r 4848e8a4afad
# EXP-Topic CONSEJIRA-491
[seda] Make "ark_naa" relation from SEDAArchiveUnit non-required

This should be required only when the entity is created alone. When it's
related to a SEDAArchiveTransfer or another SEDAArchiveUnit, the ARK naa
of its parent should be used.

In schema.py, we add a new class for "ark_naa" relation definition with
SEDAArchiveUnit as subject. Since the "description" attribute is common
with mandatory_ark_naa class, we factor it out in "_ark_naa" base class.

CONSEJIRA-491

diff --git a/cubicweb_saem_ref/migration/0.20.3_Any.py b/cubicweb_saem_ref/migration/0.20.3_Any.py
new file mode 100644
--- /dev/null
+++ b/cubicweb_saem_ref/migration/0.20.3_Any.py
@@ -0,0 +1,1 @@
+sync_schema_props_perms('ark_naa')
diff --git a/cubicweb_saem_ref/schema.py b/cubicweb_saem_ref/schema.py
--- a/cubicweb_saem_ref/schema.py
+++ b/cubicweb_saem_ref/schema.py
@@ -424,6 +424,7 @@ class _ark_naa(RelationDefinition):
     name = 'ark_naa'
     object = 'ArkNameAssigningAuthority'
     inlined = True
+    description = _("ARK identifier Name Assigning Authority (NAA)")
 
 
 class organization_ark_naa(_ark_naa):
@@ -444,9 +445,18 @@ class mandatory_ark_naa(_ark_naa):
         'add': ('managers', 'users',),
         'delete': (),
     }
-    subject = ('AuthorityRecord', 'SEDAArchiveTransfer', 'SEDAArchiveUnit')
+    subject = ('AuthorityRecord', 'SEDAArchiveTransfer')
     cardinality = '1*'
-    description = _("ARK identifier Name Assigning Authority (NAA)")
+
+
+class archive_unit_ark_naa(_ark_naa):
+    __permissions__ = {
+        'read': ('managers', 'users', 'guests'),
+        'add': ('managers', 'users',),
+        'delete': (),
+    }
+    subject = 'SEDAArchiveUnit'
+    cardinality = '?*'
 
 
 class optional_ark_naa(_ark_naa):



More information about the saem-devel mailing list