diff --git a/browser/common.py b/browser/common.py
index 42f648f..d62cf77 100644
--- a/browser/common.py
+++ b/browser/common.py
@@ -60,7 +60,7 @@ from cybertools.typology.interfaces import IType, ITypeManager
from loops.common import adapted
from loops.config.base import DummyOptions
from loops.i18n.browser import I18NView
-from loops.interfaces import IResource, IView, INode
+from loops.interfaces import IResource, IView, INode, ITypeConcept
from loops.organize.tracking import access
from loops.resource import Resource
from loops.security.common import canAccessObject, canListObject, canWriteObject
@@ -413,6 +413,8 @@ class BaseView(GenericView, I18NView):
@Lazy
def options(self):
+ if ITypeConcept.providedBy(self.adapted):
+ return DummyOptions()
return component.queryAdapter(self.adapted, IOptions) or DummyOptions()
@Lazy
diff --git a/compound/blog/configure.zcml b/compound/blog/configure.zcml
index b73d492..009827b 100644
--- a/compound/blog/configure.zcml
+++ b/compound/blog/configure.zcml
@@ -12,6 +12,8 @@
+
diff --git a/compound/blog/security.py b/compound/blog/security.py
index 7869808..aff9715 100644
--- a/compound/blog/security.py
+++ b/compound/blog/security.py
@@ -43,24 +43,27 @@ class BlogPostSecuritySetter(BaseSecuritySetter):
def setDefaultPrincipalRoles(self):
assignOwner(self.context.context, self.principalId)
- def setAcquiredRolePermissions(self, relation, revert=False):
- if isAcquiring(relation.predicate):
+ def setAcquiredSecurity(self, relation, revert=False):
+ #if self.isAcquiring(relation.predicate):
+ if relation.predicate in self.acquiringPredicates:
allowEditingForOwner(relation.second, revert=revert)
if self.context.private:
restrictView(relation.second, revert=revert)
-
- def setAcquiredPrincipalRoles(self, relation, revert=False):
- if isAcquiring(relation.predicate):
if revert:
removeOwner(relation.second, self.principalId)
else:
assignOwner(relation.second, self.principalId)
+ @Lazy
+ def acquiringPredicates(self):
+ names = ('ispartof',)
+ return [self.conceptManager.get(n) for n in names]
+
@Lazy
def principalId(self):
return getCurrentPrincipal().id
def isAcquiring(predicate):
- # TODO: use a predicate property for this.
+ # TODO: use a predicate option for this.
return getName(predicate) in ('ispartof',)
diff --git a/interfaces.py b/interfaces.py
index fb0f059..554fe60 100644
--- a/interfaces.py
+++ b/interfaces.py
@@ -271,11 +271,6 @@ class IBaseResource(ILoopsObject):
source="loops.resourceTypeSource",
required=False)
- def getType():
- """ Return a concept that provides the object's type, i.e. the
- resourceType attribute.
- """
-
data = schema.Bytes(
title=_(u'Data'),
description=_(u'Resource raw data'),
@@ -290,6 +285,38 @@ class IBaseResource(ILoopsObject):
missing_value='',
required=False)
+ def getType():
+ """ Return a concept that provides the object's type, i.e. the
+ resourceType attribute.
+ """
+
+ def getClients(relationships=None):
+ """ Return a sequence of objects that the resource is the target of.
+ """
+
+ def getConcepts(predicates=None):
+ """ Return a tuple of concepts related to self as parent concepts,
+ optionally restricted to the predicates given.
+ """
+
+ def getConceptRelations(predicates=None, concepts=None):
+ """ Return a sequence of relations to concepts assigned to self
+ as parent concepts, optionally restricted to the predicates given
+ or to a certain concept.
+ """
+
+ def assignConcept(concept, predicate):
+ """ Assign an existing concept to self using the predicate given.
+ The assigned concept will be a parent concept of self.
+
+ The predicate defaults to the concept manager's default predicate.
+ """
+
+ def deassignConcept(concept, predicates=None):
+ """ Remove the concept relations to the concept given from self,
+ optionally restricting them to the predicates given.
+ """
+
class IBaseResourceSchema(Interface):
""" New schema for resources; to be used by sub-interfaces that will
@@ -334,33 +361,6 @@ class IResource(ILoopsObject, IPotentialTarget):
available via a view or a concept.
"""
- def getClients(relationships=None):
- """ Return a sequence of objects that the resource is the target of.
- """
-
- def getConcepts(predicates=None):
- """ Return a tuple of concepts related to self as parent concepts,
- optionally restricted to the predicates given.
- """
-
- def getConceptRelations(predicates=None, concepts=None):
- """ Return a sequence of relations to concepts assigned to self
- as parent concepts, optionally restricted to the predicates given
- or to a certain concept.
- """
-
- def assignConcept(concept, predicate):
- """ Assign an existing concept to self using the predicate given.
- The assigned concept will be a parent concept of self.
-
- The predicate defaults to the concept manager's default predicate.
- """
-
- def deassignConcept(concept, predicates=None):
- """ Remove the concept relations to the concept given from self,
- optionally restricting them to the predicates given.
- """
-
class IDocumentSchema(IResourceSchema):
diff --git a/organize/browser/configure.zcml b/organize/browser/configure.zcml
index 8c122eb..457837f 100644
--- a/organize/browser/configure.zcml
+++ b/organize/browser/configure.zcml
@@ -25,13 +25,13 @@
for="loops.interfaces.INode"
name="register_user.html"
class="loops.organize.browser.member.MemberRegistration"
- permission="zope.Public" />
+ permission="zope.View" />
+ permission="zope.View" />
>> startObj['id'], startObj['name'], startObj['title'], startObj['type']
- ('3', u'domain', u'Domain', '0')
+ ('4', u'domain', u'Domain', '0')
There are a few standard objects we can retrieve directly:
>>> defaultPred = xrf.getDefaultPredicate()
>>> defaultPred['id'], defaultPred['name']
- ('14', u'standard')
+ ('3', u'standard')
>>> typePred = xrf.getTypePredicate()
>>> typePred['id'], typePred['name']
('1', u'hasType')
@@ -78,12 +78,12 @@ applied in an explicit assignment.
We can also retrieve a certain object by its id or its name:
- >>> obj2 = xrf.getObjectById('5')
+ >>> obj2 = xrf.getObjectById('4')
>>> obj2['id'], obj2['name']
- ('5', u'note')
+ ('4', u'domain')
>>> textdoc = xrf.getObjectByName(u'textdocument')
>>> textdoc['id'], textdoc['name']
- ('9', u'textdocument')
+ ('10', u'textdocument')
All methods that retrieve one object also returns its children and parents:
@@ -115,7 +115,7 @@ We can also retrieve children and parents explicitely:
[u'customer', u'domain', u'file', u'note', u'person', u'predicate',
u'task', u'textdocument', u'topic', u'type']
- >>> pa = xrf.getParents('7')
+ >>> pa = xrf.getParents('6')
>>> len(pa)
1
>>> pa[0]['name']