hide my sites option from dockbar liferay - liferay

i m using liferay6.2 ga2 i want to hide mysites from dockbar for all users except admin user .i know its possible through hook and referred the below link
http://findnerd.com/list/view/Hiding-My-Sites-Menu-in-Docbar-in-Liferay/1940/
but inside dockbar portlet in view_my_sites.jspf which part of the code must be modified.
can anybody please provide solution how view_my_sites.jspf file must be modified or any informative reference about hiding my sites option from dockbar.
thanks in advance

Helo Heena,
You must implement in your Theme a logic to restrict this.
I remember that this logic must be included into portal-normal.vm accessing ThemeDisplay Object.
It should be something like this:
set ($expando= $themeDisplay.getScopeGroup().getExpandoBridge())
set ($group = $expando.getAttribute("isAdmin"))
if ($isAdmin!= true)
set ("Logic to enable or disable options")
end
I hope that this could be useful for you.

Hi if you look into the init.vm or init.ftl and search for my sites you see couple of variables there. I would expect that setting the show_my_sites to false would make the my site option disappear (needs to be tested).
To detect, if the current user is admin i would user permissionChecker.isOmniadmin(). The permissionChecker variable is available in the context. The other option is to get user roles and check if the user has a specific role.

If you are willing to hide 'Go To' option from the dock bar of Liferay for non-admin users, then please navigate to {TOMCAT_HOME}\webapps\ROOT\html\portlet\dockbar and open the 'view.jsp' and search for the if condition "> and replace the same with the ">. Thanks.

Related

Liferay: Remove 'Account Settings' fields

I'm currently trying to remove fields from the Account Settings page and I am not sure how to properly approach this.
There's not really a proper way I can do this with CSS as it's a bit of a hacky way and it won't do the job properly as I can't access that page through CSS properly.
Also on this topic, when accessing the Account Settings page, my custom theme changes to the admin theme. Is there a reason this happens when accessing this page, even while signed in as a user?
You can disable few fields based on properties/setting ,
Ex if you want to hide birthday fields then you can set this 
field.enable.com.liferay.portal.kernel.model.Contact.birthday=false same way  for gender also u can user
field.enable.com.liferay.portal.kernel.model.Contact.male=false,  but if  you want to hide  any  other field for which property/setting is not available you can actually do it either by theme or fragment module(hook).
To do from theme you may need to create a theme for control panel as, account setting resides in uses control panel theme  and then hide respected fields based on id
To do from fragment module you can refer below link
https://portal.liferay.dev/docs/7-1/tutorials/-/knowledge_base/t/jsp-overrides-using-osgi-fragments
Thanks

How to edit default portlet in Liferay 7 Control Panel?

Is it possible to edit portlet/page in Control Panel in Liferay 7.0 ga4?
In my case, I want to add a custom column in Users table in 'Users and Organizations' section.
Yes, it's possible, and you do so just like you'd do for any other stock portlet. While there are extra mechanics to make them appear in control panel, you don't need to get in contact with these if you just modify.
Inspect the Dom to get a hint for the portlet that you're looking for.
An alternative that'd be better maintainable would be to write your own portlet instead of modifying an existing one. But that's not what you ask for here.

How to add links to other portlets in Liferay dockbar -> user dropdown?

I've just got stuck with the portal when it comes to editing the dockbar. What I need to do is to have the possibility to customize (in principle add new portlets to) the dockbar's user dropdown (the one most right hand side).
What I mean is that when you open the dropdown list you have these fancy buttons such as my account, my dashboard, my profile. And I'd like to add there links to my own portlets like 'SamplePortlet' 'Hello' etc.
Specifically I want to give user the possibility to manage that, and let him put the portlets he wants there to appear, but at first I'd like to know how to modify it in general.
I think I've tried some stuff from the internet, hooks or properties but none seemed to do anything at all. Have you got any ideas?

hide pages in websphere portal without using set parameters

I am using WebSphere Portal 8.5 Enable. I have created a custom theme. But this theme requires to hide pages on navigation which has unique name with ".omit." value in it, so that I don't have to manually set each page's parameter.
I created the flyout or menu dropdown using this:
Flyout or Menu Dropdown in Portal 8 themes
Any suggestions and pointers are welcome. Thanks in advance.
Maybe you have already thought about this.
The solution you mentioned (Flyout or Menu Dropdown in Portal 8 themes) hides nodes based on the hidden flag. This method is used to calculate it. Now you could query the uniquename of the Node witin this method and check for your naming pattern and use this to determine if it is hidden. It would allow you to combine the two as well.
the method I think you need to modify.
public boolean isHiddenPage(NavigationNode node){
if (node instanceof com.ibm.portal.MetaDataProvider) {
com.ibm.portal.MetaData iMetaData=((com.ibm.portal.MetaDataProvider) node).getMetaData();
Object url=iMetaData.getValue("hide.from.menu");
return (url != null && url.toString().equals("true"));
}
return false;
}
You can hide any page using the role settings just create a user group which is never used and make that the only thing that can access the page. You should be able to do this is your PAA's PageAssignAccessControl.xml (could be slightly wrong about the name of this file) as well as in the portal Admin console, so you can do it automatically in your deployment code.

Hide Liferay control panel options form users

I am developing a liferay portlet using liferay6.1 and SDK for Java.
When user logs in and they click on control panel they can see all kind of options. Is there a way to hide this options?
I am still new but i think that you can hide it from the portal.ext.properties but I am not sure and I have no idea.
Any help will be appreciated!
Thanks in advance!
You can show/hide control panel entries by implementing the interface com.liferay.portlet.ControlPanelEntry. This interface defines a couple of methods (isVisible/hasAccessPermission) that determine if a particular user sees/has access to one of the control panel entries.
The association between a portlet and its ControlPanelEntry class is defined in the liferay-portlet.xml configuration file. To override its value, you must use the ext-plugin.
Take a look at http://www.liferay.com/dtd/liferay-portlet-app_6_1_0.dtd for more information (search for control-panel-entry).
The configuration can be do by role-permissions of user and power-user. Go to "Control Panel" -> "Roles" -> Looking for User-Role (then Power-User) -> Define Permissions. Disable in area "Permission for Control Panel" the View-Permission for Items that must be hide.
Over.
Hide and disable access to liferay control panel
This blog will help you

Resources