I am working on a website where there will be users publishing contents.
How can I restrict users from accessing other users' contents and only able to view, edit or delete their own contents?
You can set these permissions at
People > Permissions. Take a look at the 'Node' section. Also, a very practical module for specific cases is Field Permissions.
The Field Permissions module allows site administrators to set field-level permissions to edit, view and create fields on any entity.
You can use Node Access Rules module.This module control the access to a certain node or node group by Rules. It allows you to control the access to a node (create/view/edit/delete) by Rules.
What you're talking about is Drupal node access control.
The core's built-in support for node access control is rather course, in particular when it comes to viewing content. If your specific requirement is that user shall only be able only be able to view, edit or delete his/her own contents, the simplest solution is to not publish the content.
You do this by setting the the default state for a new node to unpublished. Navigate to Administration » Structure » Content types, and then pick the content type. Under Publishing options you untick the option Published. Then, to allow user to see his/her own content, navigate to Administration » People » Permissions and tick the permission View own unpublished content for the authenticated user. To allow the user to edit and delete his/her own contect rick the persmissions Create new content, Editit own content, Delete own content for all the content types you want your users to be able to use.
The above solution is for Drupal 7 and can be realized with the functionality in core alone.
If you for some reason can not use the solution outlined above, you must use some sort of node access control module to control the access to view the node (create new, and edit/delete own can still be controlled by means of core user permissions). There is a page at Drupal.org listing all node access modules, with a capsule review of each. I suggest you take a look at that page to see if you can find a suitable module.
After few days of research I finally find an easy way to manage users control over their own content.
Visit http://drupal.org/project/workspace to download the latest version of "Workspace".
Extract the files into a folders on your desktop. The folder will be called "workspace".
Login to your site's files via FTP and navigate to /sites/all/. If there isn't a folder called /modules/ here, create one.
Upload the "workspace" folder to /sites/all/modules/
Go to Administer >> Site building >> Modules and enable Workspace. You'll need to check only one box.
When your users login they'll see a link in the admin menu called "My Workspace". When they click on it they'll see a screen like this: