Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Alfresco 3 Cookbook

You're reading from   Alfresco 3 Cookbook Over 70 recipes for implementing the most important functionalities of Alfresco

Arrow left icon
Product type Paperback
Published in Jul 2011
Publisher Packt
ISBN-13 9781849511087
Length 380 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Toc

Table of Contents (21) Chapters Close

Alfresco 3 Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Getting Started FREE CHAPTER 2. Creating and Organizing Contents 3. Securing and Searching Contents 4. Rules—the Smart Spaces 5. Alfresco Administration Console 6. Customizing Alfresco Web Client 7. Alfresco Content Model 8. Alfresco JavaScript API 9. FreeMarker Templates 10. Web Scripts 11. Working with Workflows 12. Integrating with MS Outlook and MS Office 13. Configuring Alfresco E-Mail and File Servers 14. Building Alfresco Index

Assigning permissions to a user


We will see in this recipe how to assign various permissions to a particular user.

How to do it...

  1. 1. Create a new script file in the Company Home>Data Dictionary>Scripts>Cookbook folder and save this code. Let’s say the file is named assignpermission.js.

    var qry = "@cm\\:name:\"Test_JS_API.txt\"";
    var docs = search.luceneSearch(qry);
    if (docs.length > 0)
    {
    var doc = docs[0];
    if (doc.hasPermission("ChangePermissions"))
    {
    var usr = people.getPerson("snig.bhaumik");
    if (usr != null)
    {
    doc.setPermission("Write", "snig.bhaumik");
    doc.setPermission("Delete", "snig.bhaumik");
    doc.setPermission("AddChildren", "snig.bhaumik");
    doc.setPermission("Execute", "snig.bhaumik");
    }
    }
    }
    
  2. 2. Execute the script using Run Action on the document Test_JS_API.txt in the Chapter 8 folder.

  3. 3. Upon executing the script, the user snig.bhaumik will have write, delete, and execute the permission of this document.

  4. 4. Let’s examine what happened behind the scenes. This was the original...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime