cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any way to restrict content type in folder

silverhoof
Champ in-the-making
Champ in-the-making
There is requirements of restrict content type and/or content MIME type in alfresco share document library folders.
For example only someco:whitepaper type is allowed in the Whitepaper folder and the MIME type should be PowerPoint or Word document.
What should I do to archive that goal ?
9 REPLIES 9

billerby
Champ on-the-rise
Champ on-the-rise
There is as far as I know two ways to handle this.

- Use the rule engine. Add a rule to this folder. When new content is entered you choose to execute a server side javascript where you implement the behaviour you want using the alfresco javascript API.

- Implement a server side java behaviour which implement a NodeServicePolicy. There are a variety of policies to implement like onBeforeCreate or onCreate. If the content that is about to be created not meets your requirement (ie your specified content type or mimetype) you wont allow it to be created.

/Erik

silverhoof
Champ in-the-making
Champ in-the-making
Suppose the user creates or updates a node, the rule is fired when the note change is done.
Does the javascript action be able to deny the update of this node?

mitpatoliya
Star Collaborator
Star Collaborator
Yes you can create the rule which gets fired on the content update.
I mean during creation of rule we can set that it should fire on content update.
We can choose the secript in that rule with that rule which will do the rest of the work.

silverhoof
Champ in-the-making
Champ in-the-making
Yes you can create the rule which gets fired on the content update.
I mean during creation of rule we can set that it should fire on content update.
We can choose the secript in that rule with that rule which will do the rest of the work.

My question is if I setup a rule that will fire on each content create or update, the action is taken place when the content creation or update is done, am I right?
If the action is called after the creation or update of the content is done, then how to deny content creation or update. What should I do in the action?

billerby
Champ on-the-rise
Champ on-the-rise
Delete the content?

/Erik

silverhoof
Champ in-the-making
Champ in-the-making
Delete the content?

/Erik

It is absolutely not user friendly to just delete the content when content type or MIME type restriction violation is detected.

I am thinking of another way.
Maybe I can develop an custom aspect to add to folder which can have property to define allowed content types and corresponding MIME types.
Provide custom content creation and modification page to those folder which have the aspect.
Those page should have the ability to restrict content type choice and enforce the restriction (do not allow submit if there is policy violation) .

Does alfresco share support that kind of extension?

billerby
Champ on-the-rise
Champ on-the-rise
Yeah your right, not user friendly at all…sorry Smiley Happy

Read this blog post about customizing the file upload. http://www.ixxus.com/blog/2011/09/customising-the-upload-file-dialog-box-in-alfresco-share/

You could then present a list in this gui with the allowed file types which you could supply from a web script.

Have in mind that you still might need to do it the non user friendly way if the user chooses to use drag and drop when uploading content.

/Erik

silverhoof
Champ in-the-making
Champ in-the-making
Thanks for your help, I am now trying to implement this.
And I think this is a very useful feature, and should be placed in the feature requirement list of future alfresco releases.  Smiley Happy

billerby
Champ on-the-rise
Champ on-the-rise
If you are able to package it in a nice way (AMP for example), you could always contribute it to the http://addons.alfresco.com

/Erik