пятница, 20 августа 2010 г.

Fun with alfresco types.

Good day!

Yesterday, I had some fun with alfresco types and permissions. I've created simple type in my model that looks like this:
  1. <type name="my:simpleType">  
  2.   <title>Simple type</title>  
  3.   <properties>  
  4.     <property name="my:prop">  
  5.        <type>d:int</type>  
  6.     </property>  
  7.   </properties>  
  8. </type>  

I've included it as child-association to the other type and tried to create it:
  1. Node simpleProp = parentNode.addProperty("my:parentProp""my:simpleType");  
  2.   simpleProp.setProperty("my:prop"1);//AccessDeniedException here!  

But, when I ran JUnit test, it threw AccessDeniedException on setProperty for that node. I started debugging alfresco sources, but still I couldn't understand what is going on. Why can I create parent node, add node to association, but can not set property for this node???!!! I tried to use NodeService without JCR API, but I've got the same trouble. Then, I discovered all sources of alfresco's permission subsystem(PermissionServiceImpl, SecurityProvider, etc) with acegi, but still in vain :(

By the end of the day, I have got two cigarettes and zero ideas. After first cigarette, I was looking at my model trying to find problem and finally I've got it! My new type had no parent type! When I added
  1. <parent>cm:content</parent>  

everything worked fine! That was hard day: one day - one string...fast work :)

Комментариев нет:

Most popular

Authors