In order to place your custom portlet to the control panel just add the following lines to your liferay-portlet.xml:
Liferay-Blog
/icon.png
apps
100
de.blogspot.blog.liferay.ControlPanelEntryHandler
...
Here are the explanations taken from liferay-portlet-app_6_2_0.dtd:
control-panel-entry-category:
Set the control-panel-entry-category value to "my" to make this portlet
available within the My Account administration of the user. Set the value to
"apps", "configuration", "sites", or "users" to make it available in the Control
Panel under that category. Set the value to "site_administration.configuration",
"site_administration.content", "site_administration.pages" or
"site_administration.users" to make it available in the Site Administration
under that category. Legacy values from previous versions of Liferay will be
automatically mapped to the new values: "content" to
"site_administration.content", "portal" to "users", and "server" to "apps".
[Source]
control-panel-entry-weight:
Set the control-panel-entry-weight value to a double number to control the
position of the entry within its Control Panel category. Higher values mean
that the entry will appear lower in the Control Panel menu.
[Source]
control-panel-entry-class:
The control-panel-entry-class value must be a class that implements
com.liferay.portlet.ControlPanelEntry and is called by the Control Panel to
decide whether the portlet should be shown to a specific user in a specific
context.
[Source]
In your control-panel-entry-class you might for example check whether the user has a certain regular role or not. Here is a example where I check if the user has a regular role called "Liferay-Blog":
package de.blogspot.blog.liferay;
import com.liferay.portal.model.Group;
import com.liferay.portal.model.Portlet;
import com.liferay.portal.model.Role;
import com.liferay.portal.model.User;
import com.liferay.portal.security.permission.PermissionChecker;
import com.liferay.portal.service.RoleLocalServiceUtil;
import com.liferay.portal.util.PortalUtil;
import com.liferay.portlet.BaseControlPanelEntry;
public class ControlPanelEntryHandler extends BaseControlPanelEntry{
@Override
public boolean hasAccessPermission(PermissionChecker permissionChecker, Group group, Portlet portlet) throws Exception {
User user = permissionChecker.getUser();
Role liferayBlogRole = RoleLocalServiceUtil.getRole(PortalUtil.getDefaultCompanyId(), "Liferay-Blog");
boolean hasAccessPermission = RoleLocalServiceUtil.hasUserRole(user.getUserId(), liferayBlogRole.getRoleId());
return hasAccessPermission;
}
}