Wednesday, March 17, 2010

Managing content with Role and Permissions in dotCMS

In my previous post I mentioned how to create a blog site using templates, containers and contents in dotCMS. After the site has been created you need to add posts to it so that it can go publishing all its posts.

By default the content created contains the permissions of their parent structure. However in most of the cases it is required to give certain permissions to certain group of users/roles. In our case we will create a user mysiteuser and assign it a group mysitegroup. We will also create a role called mysiterole and this role will be granted to mysitegroup.

Using this as an example we will allow users having mysiterole only to add content/post to the blog just created.

1. Add New Role
Click on CMS Admin link and chose New -> Role from the drop down. This will lead to a screen where you can add a new role named as mysiterole.

2. Add New Group

Click on CMS Admin link and chose New -> Group from the drop down. This will lead to a screen where you can add a new group named as mysitegroup.

3. Add New User
Click on CMS Admin link and chose New -> User from the drop down. This will lead to a screen where you can add a new user named as mysiteuser by filling all its details.

4. Assign Role to mysiteuser.
Click on CMS Admin link and chose Users. This will show a screen containing search button. Click on Search button. It will populate the newly created user mysiteuser. Select the user and click on User Roles tab from the screen. Now there will be a screen showing available and current roles.
Chose CMS User Role from Available to Current list. This role is important because of this is the parent role of all dotCMS editing roles.  
5. Assigning Group to mysiteuser.
Click on CMS Admin link and chose Users. This will show a screen containing search button. Click on Search button. It will populate the newly created user mysiteuser. Select the user and click on User Groups tab from the screen. Now there will be a screen showing available and current group.
Chose CMS Users group from Available to Current list. 

6. Adding Role mysiterole to mysitegroup.
Click on CMS Admin link and chose Permissions -> Groups. This will show a screen containing newly created group mysearchgroup in the left side. Click on mysitegroup. It will enable few options downwards. Click on Edit Roles button. It will open a screen containing available and current roles for th group. Select mysiterole from the available list and click update button.

7. Editing pages for the role
Click on CMS Admin link and chose Permissions -> Groups. This will show a screen containing newly created group mysearchgroup in the left side. Click on mysitegroup. It will enable few options downwards. Click on Edit Pages button. It will populate a screen as follows.

Inside the Add New Page text box write the name of content "Content" and click on Update Page Settings button. It will now reflect a new screen downwards as follows.

Click on Selected Page "Content" from the drop down  menu and click on Content Management link under categories tab. Now select Content Search Manager(n) from the list of checkboxes. Click on Update Content Settings button to make changes permanent.

8. Change the permissions of Blog structure.
Click on Structures link and chose structures. This will show a screen containing all structures. Click on Blog. Then click on Permissions tab and check mysiterole and CMS Anonymous role under View column.


9. Change the permission of the Blog Entry structure.
Click on Structures link and chose structures. This will show a screen containing all structures. Click on Blog Entry. Then click on Permissions tab and check View, Modify and Publish permissions to mysiterole. Also give View permission to CMS Anonymous role.

This now completed the assigning permissions and role to a blog site. Now only user mysiteuser will be able to create a blog post when logged into the system. After you login to the system as mysiteuser it will look like as follows.

By clicking on Add New Content and selecting Blog Entry from the drop down you will be able to go to following screen where you can write your contents of post.
After you are done with writing your changes, you need to relate this blog post with one of the blogs. You can do it by going to relationship tab and clicking on Relate Content button. This will populate a search screen. You need to search for the relevant blog and relate content.

Sphere: Related Content

Creating a blog Site with dotCMS(A Open Source Java CMS)

In my organization I had to create a blog site for one of my International team. The obvious options were to chose from vast range of PHP based CMS. But due to some technical issues we could not proceed to them and we were asked to use Open Source Java based CMS. After few days analysis we found that dotCMS matched our requirements for the blog site.

I searched on the net and found very little documentation on how to work with dotCMS however. It took me couple of days to figure out how to make a customized site only for blogging using dotCMS.

Here are few building blocks of dotCMS architecture.

1.Structure
2.Content
3.Category
4.Relationship
5.Container
6.Template

For any site we need to understand these properly and the initial documentation is given at this url

dotCMS comes bundled with a starter site that contains a blog module in itself. We will use this blog module to create a blog site of us named as MySite.

We will first login as admin user(test@dotcms.org/test) to http://localhost/c url.
We see that there are bunch of links available there for managing whole site. However initially we will be interested only in Container and Template section.



In every website we have few elements common to all like Header, Footer, Left Side Navigation, Right Side Navigation and Center Body. There also needs to be a template file which will contain all these elements.

Hence we will create/modify few files for things to work.

1.Create a container MySite-Header by clicking on Add/Edit Container link and write down the html that will go to your header

2.Create a container MySite-Footer by clicking on Add/Edit Container link and write down the html that will go to your footer

3.Create a container MySite-CenterBody by clicking on Add/Edit Container link and write down the html that will go to your center body(Make sure you have selected max contents to be non zero). Chose WebPageContent as content's structure. Normally the code for the body will be $!{Body} because it will be replaced with the content you will add to the center body container.

4.Create a container MySite-LeftSideNavBar by clicking on Add/Edit Container link and write down the html that will go to your Left Side Navigation Bar

5.Create a container MySite-RightSideNavBar fby clicking on Add/Edit Container link and write down the html that will go to your Right Side Navigation Bar

6.Create a template MySite-Template by clicking on Templates and then Add/Edit Templates link. You will write here the overall layout of the site. While creating the template code you also need to include the headers, footer, center body, left side navigation bar, right side navigation bar container just created above. For this you need to click on Add Container button and search for all your containers, this selected container will now be included in the code of your template created.

Click on Save and Publish to make your template active.

Now click on Browser section and browse to /global/images and create a new folder called mysite  by right clicking on images->New->Folder

Now upload all your css/images files there. You may also create a separate folder for images and css in the same way.

Now Go to Browser section again and disable all shown folders to be shown on Main Menu by right clicking on each folder and selecting Edit. Make sure you have unchecked the Show on Menu checkbox.

Now we will modify the pages in /blog directory to customize them. First of all we will modify the index.dot file by double clicking on /blog/index.dot.  When you click on the index.dot you will see a link  Page Properties on the top left side of the page. By Clicking on this link we will change the page template to our created MySite-Template.


We will change the templates of all the files present in /blog folder so that every page is in consistency with the site template.


We will now start adding actual content to all the pages modified.

For doing this we need to click on Add Content link and selecting Reuse content from the drop down. We need to search for "Widget-blog listing" content from the search window.

We need to add the content "widget - Entries by tag" in tags.dot.

Now click on add content button and chose widget - Blog Entry Detail (with audio catcha) to /blog/detail.dot

Add the content "Contributor Blog Entries" in contributor_blog_entries.dot

Add the content "Blog Archived List" in archived_blog_list.dot

Add the content "Widget - Blog listing" again to entries.dot

This now completes the blog site creation tutorial. I will update the role and user creation tutorial in next few days.

Sphere: Related Content