RE: How hide or disable menu from control panel Liferay 7.1 GA 3

thumbnail
gnp present, modified 6 Years ago. Junior Member Posts: 55 Join Date: 6/9/10 Recent Posts
Please help: how can i disable or hide what i put in red in pictures atachament? (just for users)

thank you
thumbnail
Nader Jafari, modified 6 Years ago. Junior Member Posts: 84 Join Date: 8/24/11 Recent Posts
What is user roles?
Are you member of this site?

for hide this section you can use "Theme contributors" by read this article : https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/theme-contributors
thumbnail
Olaf Kock, modified 6 Years ago. Junior Member Posts: 55 Join Date: 6/9/10 Recent Posts
Hi..thank you for your quicly response..."just for users role"  i wanted to say any role from portal exception power user or admin roles. For use contributor is a hard way

...I thought there was another simpler way to do this..

​​​​​​​thank you
thumbnail
Andrew Jardine, modified 6 Years ago. Liferay Legend Posts: 2416 Join Date: 12/22/10 Recent Posts
I wonder if maybe this property would help?​​​​​​​
​​​​​​​
#
# Set this to true to allow site members to see the Sites Admin portlet
# and the sites they are members of in the Control Panel. Setting this to
# false will only allow administrators to see this portlet in the Control
# Panel.
#
# Env: LIFERAY_SITES_PERIOD_CONTROL_PERIOD_PANEL_PERIOD_MEMBERS_PERIOD_VISIBLE
#
sites.control.panel.members.visible=true
thumbnail
gnp present, modified 6 Years ago. Junior Member Posts: 55 Join Date: 6/9/10 Recent Posts
Hi... Thank you .. i tryed but no works ...but works fine just for another sites not for my default website. 
thumbnail
Andrew Jardine, modified 6 Years ago. Liferay Legend Posts: 2416 Join Date: 12/22/10 Recent Posts
Ah, too bad. Yeah the default site often has a few "except if ..." Scenarios to prevent you from doing something catastrophic that would make the site unreachable. 

​​​​​​​Just to double check because the comment specifically referenced it... You weren't testing as the ad in right? I suspect not so CE you said it worked for the other sites, but just double checking.
thumbnail
gnp present, modified 6 Years ago. Junior Member Posts: 55 Join Date: 6/9/10 Recent Posts
i checked several times...the default site is always there...

​​​​​​​thank you anyway 
thumbnail
Andrew Jardine, modified 6 Years ago. Liferay Legend Posts: 2416 Join Date: 12/22/10 Recent Posts
Alright -- next thing you could try. All those thing on the left are referred to as PanelCategory classes. Liferay like to help us out by using a standard naming convention so I am willing to be that the thing you are looking at is this class -
package com.liferay.product.navigation.site.administration.internal.application.list;

import com.liferay.application.list.BaseJSPPanelCategory;
import com.liferay.application.list.GroupProvider;
import com.liferay.application.list.PanelCategory;
import com.liferay.application.list.constants.ApplicationListWebKeys;
import com.liferay.application.list.constants.PanelCategoryKeys;
import com.liferay.item.selector.ItemSelector;
import com.liferay.portal.kernel.language.LanguageUtil;
import com.liferay.product.navigation.site.administration.internal.constants.SiteAdministrationWebKeys;
import com.liferay.site.util.GroupURLProvider;
import com.liferay.site.util.RecentGroupManager;

import java.io.IOException;

import java.util.Locale;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;

/**
 * @author Eudaldo Alonso
 */
@Component(
   immediate = true,
   property = {
      "panel.category.key=" + PanelCategoryKeys.ROOT,
      "panel.category.order:Integer=300"
   },
   service = PanelCategory.class
)
public class SiteAdministrationPanelCategory extends BaseJSPPanelCategory {

   @Override
   public String getHeaderJspPath() {
      return "/sites/site_administration_header.jsp";
   }

   @Override
   public String getJspPath() {
      return "/sites/site_administration_body.jsp";
   }

   @Override
   public String getKey() {
      return PanelCategoryKeys.SITE_ADMINISTRATION;
   }

   @Override
   public String getLabel(Locale locale) {
      return LanguageUtil.get(locale, "site-administration");
   }

   @Override
   public boolean include(
         HttpServletRequest request, HttpServletResponse response)
      throws IOException {

      request.setAttribute(ApplicationListWebKeys.PANEL_CATEGORY, this);

      return super.include(request, response);
...

}

Assuming this is right, I then opened --
"/sites/site_administration_header.jsp"

and in this file I can see --​​​​​​​
<%@ include file="/init.jsp" %>

<%
SiteAdministrationPanelCategoryDisplayContext siteAdministrationPanelCategoryDisplayContext = new SiteAdministrationPanelCategoryDisplayContext(liferayPortletRequest, liferayPortletResponse, null);

PanelCategory panelCategory = siteAdministrationPanelCategoryDisplayContext.getPanelCategory();
%>

<c:if test="<%= siteAdministrationPanelCategoryDisplayContext.isShowSiteSelector() %>">
   <div class="icon-sites">
      <liferay-ui:icon icon="sites" id="manageSitesLink" label="<%= false %>" linkCssClass="icon-monospaced" markupView="lexicon" message="go-to-other-site" url="javascript:;" />
   </div>

   &lt;%
...

</c:if>

Unfortunately, the display context objects aren't services so overriding them is tricky, but you could try one of two things next.

1. Try a service override of the PanelCategory defining your own with a higher service ranking. I would then try to return nothing for the header to see if it will omit it gracefully. It might not be expecting an empty string of a null though so this might just lead to an exception.

2. Worst case scenarion, you could use a JSP Fragment and update the logic in the JSP so that it only shows the header for Administrators or something. Better yet, tie ot to a CUSTOM portal-ext property and then you can dynamically control who can see it so that if you need more than one role to see it in the future, you can easily update via config rather than code.

.. this is all assuming of course that I am pointing you to the right files! emoticon
thumbnail
gnp present, modified 6 Years ago. Junior Member Posts: 55 Join Date: 6/9/10 Recent Posts
Ohh...it seems to be some difficult for me...i think the right way  is:

Nader JafariWhat is user roles?
Are you member of this site?

for hide this section you can use "Theme contributors" by read this article : https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/theme-contributors


​​​​​​​
thumbnail
Andrew Jardine, modified 6 Years ago. Liferay Legend Posts: 2416 Join Date: 12/22/10 Recent Posts
I suppose, but I would argue that using a theme contributor isn;t necesarily the solution. Theme contributors are intended to add things to an existing theme without a lot of work. Historically you would have to create a new theme and then set the parent to be the theme you were "overriding" and then add your customizations. Theme contributors allow you to get past a lot of that by just "appending" to an existing theme ... so for example, including a custom CSS file, or a JS library or even injecting a service to make it available in the theme.

I'm not sure how you would use a theme contributor here, unless you plan to simply target the DOM element and hide it? 
thumbnail
gnp present, modified 6 Years ago. Junior Member Posts: 55 Join Date: 6/9/10 Recent Posts
I.m not sure ...but it s not really necesary to hide that portion because not affected..just is unnecesary..that s all...anyway thanks a lot trying to help me..i really apreciate this...
thumbnail
Andrew Jardine, modified 6 Years ago. Liferay Legend Posts: 2416 Join Date: 12/22/10 Recent Posts
Rather than paste my email in a public forum, why don't you private message me on slack emoticon