[reledit] also check for cardinality before displaying the delete relation action. Closes #5334750
--- a/web/views/reledit.py Tue Apr 28 17:00:35 2015 +0200
+++ b/web/views/reledit.py Tue May 05 15:36:56 2015 +0200
@@ -213,8 +213,12 @@
entity = self.entity
if role == 'subject':
kwargs = {'fromeid': entity.eid, 'toeid': rentity.eid}
+ cardinality = rschema.rdefs[(entity.cw_etype, rentity.cw_etype)].cardinality[0]
else:
kwargs = {'fromeid': rentity.eid, 'toeid': entity.eid}
+ cardinality = rschema.rdefs[(rentity.cw_etype, entity.cw_etype)].cardinality[1]
+ if cardinality in '1+':
+ return False
# NOTE: should be sufficient given a well built schema/security
return rschema.has_perm(self._cw, 'delete', **kwargs)