cancel
Showing results for 
Search instead for 
Did you mean: 

Protect spaces

jumpm7
Champ in-the-making
Champ in-the-making
Hallo,
do you know how to protec spaces from cut or delete command? In my example I have some spaces were users work, implementing a kind of workflow. Therfore the users must have the write permission inside the spaces. The problems cames when a user makes an error and cut (or delete) an entire space. Since there is also some "simple workflows" rules, these became corrupted, alsi if the space is created again. Therefore I would like to write protect the Spaces itself leaving all the permissions for the files inside. Any clue??

Thanks

Gianpaolo
14 REPLIES 14

jayjayecl
Confirmed Champ
Confirmed Champ
Here is what I would do :

- create a custom aspect :

<aspect name="custom:protectedFolder">
        <title>Espaces proteges de copier et couper</title>
</aspect>

- then, edit your web-client-config-custom.xml :


<config evaluator="aspect-name" condition="custom:protectedFolder">
      <actions>
    <!– Actions Menu for More Actions in Browse screen –>
         <action-group id="browse_actions_menu" replace="true">
            <action idref="cut_node" hide="true"/>
            <action idref="copy_node" hide="true"/>
         </action-group>
<action-group id="space_browse">
             <action idref="cut_node" hide="true"/>
            <action idref="copy_node" hide="true" />
         </action-group>
<action-group id="space_details_actions">
              <action idref="cut_node" hide="true"/>
            <action idref="copy_node" hide="true" />
         </action-group>
   </actions>
</config>

Then, each space having this aspect won't display the "cut" and "copy" actions…

But, no user (even admin) will see these buttons

mabayona
Champ on-the-rise
Champ on-the-rise
The proposed solution is quick but what is doing is just hiding the delete, cut & co. from the web client. It is no t really protectintg against deleting or cuttng (which can be done using by program or using another interface like FTP, CIFS, WebDAV).

To make it really safe, you have to do it in the repository defining your type and associated permissions. Not easy since as you say, you need write permission for those spaces.

zaizi
Champ in-the-making
Champ in-the-making
You can just use custom behaviour to deal with deletes for the folders with the aspect.

jumpm7
Champ in-the-making
Champ in-the-making
Brilliant! I mean, even if it is not a "full" protection it is engouth strong because the main problem is the user interaction via web. Other interactions ( ftp for example ) are made by automatic scripts that are tested.
I'm going to introduce your suggestions on our system

Thanks a lot

Gianpaolo

jayjayecl
Confirmed Champ
Confirmed Champ
No problem.

Good luck

mabayona
> I thought it was not possible to define permissions based on object types yet.
Are you sure of that ?

mabayona
Champ on-the-rise
Champ on-the-rise
As mentioned above, custom behaviours can be associated to custom types for several events. The behaviour code that is then triggered can be written in java o javascript. This code can do whatever do you want it to do with the permissions of a node.

jumpm7
Champ in-the-making
Champ in-the-making
I'having a little trouble due to my poor experience in Alfresco.

What I did is:

1. In "customModel.xml" added the code about the aspect name and title
2. Renamed custom-model-contex.xml.sample in custom.model-contex.xml
3. In "web-client-config-custom.xml" added the code about aspect definition (config evaluator….etc. )
4. Restart alfresco

I have no errors in logs, but when I create a new business rule, selecting  "add aspect to item" , I cannot see the new custom aspect. I tried to activate some more debug info without any useful info.
I reviewed the procedure looking at Munwar Shariff's book and I cannot find what is wrong…

Gianpaolo

mabayona
Champ on-the-rise
Champ on-the-rise
If you want include custom behaviour, look for J. Potts tutorial at:

http://www.ecmarchitect.com
http://ecmarchitect.com/alfresco-developer-series
http://ecmarchitect.com/images/articles/alfresco-behavior/behavior-article.pdf

this is the ultimate reference on how to do it.

jayjayecl
Confirmed Champ
Confirmed Champ
You have to add the following to tyhe web-client-config-custom.xml :


<config evaluator="string-compare" condition="Action Wizards">
      <aspects>
         <aspect name="custom:protectedFolder"/>
      </aspects>
   </config>


This will tell Alfresco that you want this aspect to appear in the "add aspect to item" action dialog