Hi Charlie!

Charlie Clark wrote:
> Am 02.12.2009, 20:51 Uhr, schrieb yuppie <y.2...@wcm-solutions.de>:
>> -1
>> The real issue here is the fact that the permission argument of the
>> adapter directive is not supported in Zope 2. Otherwise we could simply
>> use this:
>>      <adapter
>>           name="myproduct.content_type_factory"
>>           factory=".myproduct.MyAddView"
>>           permission="cmf.AddPortalContent"
>>           />
>> Using the class directive instead is just a workaround for a generic
>> problem that needs a generic solution, not a new addView directive.
> I have to agree with you on that. But the current solution remains clunky.  
> Having initially been against it I think it would be easier on the eye to  
> have the security declaration (I'm assuming this would work for subclasses  
> where it can be overwritten if needs be) in ContentAddFormBase until the  
> permissions directive is supported. It was only from working with the new  
> add form that I realised how little needs to be done to work with this.


Actually it would make sense to get the permission checks in sync with 
the _checkAllowed method used by add actions. And _checkAllowed has a 
hardcoded check for AddPortalContent.

So it is indeed superfluous to configure the AddPortalContent permission 
for each add view in ZCML. And the __call__ method of ContentAddFormBase 
seems to be a good place for checking the AddPortalContent permission 
*and* the isConstructionAllowed method.

>> I currently use method aliases defined for the container to customize
>> the names shown in the URL. But that's not perfect because you can't
>> define the aliases together with the portal type and you have to define
>> them for each container type used.
> I'm not sure I understand what you mean by that - you have a situation  
> where string:${folder_url}/++add++${object_id} needs changing?

Here is an example:

<object name="Document">
  <property name="add_view_expr">string:${folder_url}/newDoc</property>

<object name="Folder">
  <alias from="newDoc" to="++add++Document"/>

>> If you have a better idea, please let me know.
> I think that we could work with a sensible default which might be  
> overwritable in the aliases?

The problem is: The indirection has to be done on container level, but 
it would be clearer to set the alias in the type info of the new object.



Zope-CMF maillist  -  Zope-CMF@zope.org

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests

Reply via email to