Drupal 8 API rest menu items not showing for anonymous users - rest

I have a create a basic page node with url alias as "/support/overview". And added in the menu navigation as menu item. I am using the rest_menu_item module, to generate the json. http://localhost/drupal8/api/menu_items/main-navigation, the added url alias in the menu item not showing for the anonymous user. Could you please help on this!

Related

TYPO3: logout button in menu

What's the best way to add a "logout" button in the menu. I am using the extensions "fe_users" and "femanager". I found a few solutions on the web but none do work.
Any link containing the GET-Parameter ?logintype=logout will cause the system to process a logout. You can either add a link with this parameter to a HMENU / TMENU or create a page of type external link in the backend and add the parameter to a link to your page and only show this page in menues when logged in.

CQ5.6 - CUG enabling for protecting pages breaks other components

We have implemented login functionality like geometrixx site in our existing website(with close to 700+ pages).
We want to show protected pages only to logged in user, every user who is registered gets assigned a group/ CUG lets say "listed users".
now in page hierarchy I have products page and under product page I have 8 products pages.somewhere On homepage I have a nav bar component which fetches all product children pages and shows a left nav bar with 8 entries.
If I enable CUG in a way that only "listed users" should have access to 2 out of 8 product pages, any access to direct links are redirected to login page. Which is fine.
But the nav bar component which earlier used to show all 8 product pages now shows only 6 pages.
The main idea behind putting pages behind login is lead generation.So if non logged in users dont see the link itself where would they click to get redirected to login page and subsequently feel like registering with our site.
Requirement is that my existing nav bar should continue showing 8 links and on click of 2 protected page links, he should get login/ register option.
We are using most of things Out of the Box.
any pointers helping in how do we achieve this would be great help ? PS: i have given a nav bar as one such component affected in existing site like this there could be many more components fetching their content from site hierarchy and stand chance to get broken in such case.
There are two entities involved, JCR and Sling.By default any un-authenticated request is associated with a user called Anonymous, the JCR sessions will have ACL's associated with anonymous.
In JCR, if a user does not have access to nodes, that session will not see those nodes.We access the JCR via Sling ,by default if you don't have permission the request will result in a 404 error(because for underlying JCR session the resource does not exist). Sling can be explicitly instructed to request for authentication for specific paths.
The combination of these concepts are leveraged to create the CUG functionality. Sling is instructed to force for authentication for CUG enabled pages. The JCR is instructed to show these nodes only for users who have access.
When you directly request the product pages without login, it is sling that is redirecting you to login page. When your navigation component is looping over nodes to create the menu for anonymous users JCR is only showing it 6 pages as the other two are out of reach for anonymous.
The only* way to work around this is to make the Navigation component configurable. Instead of node iteration, the content author will have to configure the the url and page title so that the links show up for everyone.
You can ignore the session associated with the request and use a custom JCR session that has access to all the product pages, but that would be disregarding the ACLs and you don't want to do that .
The nav bar can pick up all child pages as per page structure. That should not restrict the page title display on the nav bar.
As for the pages the access can be controlled by template level page properties by adding the 'listed users' group over there. In the jsp you can give an initial check for the user if they are a member of 'listed users' else redirect to login page
Hope that helps
Thanks for all your suggestions
Below is how we ended up doing it.
- Protect the page you want to enable CUG with proper CUG.
- Hide the page in nav.
- Create a redirect page in same hierarchy with same title as the one you wanted to protect.redirect it to your protected page.

Display pages tree

I have problem with showing tree of display pages in display pages section of web content creation form.
I created some pages with asset publishers on them. I set these publishers to be the default asset publishers for these pages. I created these pages and asset publishers under role admin. When I open display pages section in creation form of any web content it shows me site map where can I see pages on which is asset publisher, see image:
You can see that black color is for pages with asset publishers.
But when I login with another user I cannot expand this tree. The only thing I can see is "1st level" of this site map:
I tried to add all possible rights to this user, all possible rights to any resources but without assigning role "administrator" for this user I cannot browse this tree.
When I click on little "plus icon" in this tree I can see that it is making request on "/c/layouts_admin/get_layouts" but in request I can see only html which is telling me that I haven't sufficient roles to obtain right content.
I made some investigation. I tried to make request under this user from jsonws api ("/api/jsonws?signature=%2Flayout%2Fget-layouts-6-groupId-privateLayout-parentLayoutId-incomplete-start-end"). I tried the same method with same parameters as they were in request from site map tree and it returned me right content.
So from "Choose Display Page" window it tells me that I haven't good role but when I call api from jsonws with same parameters it returns me good result. Where can be problem?
Thanks,
Patrik
Hi dear Add this Snippet in com.liferay.portal.struts.PortalRequestProcessor.java
processRoles(HttpServletRequest, HttpServletResponse, ActionMapping)
After user O bject is Created.
if(user!=null){
if(path.equals("/layouts_admin/get_layouts")){
return true;
}
}

How to display a single post with wordpress menu?

I have converted a joomla website to wordpress. All categories and joomla articles are converted as wordpress categories and blog post. Now I want to show this posts (articles) with different menus. But I saw I can assign catagories in word press menu. But How can I display a single post with a menu ?
Like I have about us post , for which I want to create a menu. How can I do that ? I can convert those to pages. But I dont want to loose tags and URLs . Can anyone help please ?
Thanks
You can add any post to a menu from the "posts" box in the menu admin screen. If you don't see that box, go to the screen options for the menu screen and check "posts".
There is an option named Custom Links in wordpress menu configuration. Just name label as "About Us", and give your post link in url field.
create separate page template for every single menu. In these page templates write a php code to fetch content from single category. Create pages in admin and assign a page template to each page into admin. This will fetch content from different category on different menu that u want.

How to hide "User Information" options from "My Account" in Liferay 6.1?

I am trying to hide some options in "User Information" from My Account by using hook. I just want to hide it using CSS (style="display:none"). User Information is present in the right side of My Account Page.
I want to know, in which page I should make changes? While creating hook which page I should select for hiding those links like "Organizations, Sites, etc." Please help...
You have to choose the tab you want by writing them in the portal-ext.properties as follow :
#
# Input a list of sections that will be included as part of the user form
# when updating a user in the My Account portlet.
users.form.my.account.main=details,password,organizations,sites,user-groups,roles,personal-site,categorization
users.form.my.account.identification=addresses,phone-numbers,additional-email-addresses,websites,instant-messenger,social-network,sms,open-id
users.form.my.account.miscellaneous=announcements,display-settings,comments,custom-fields
Each field will be linked to its jsp. For exemple, "details" will display details.jsp.
Since your problem is finding the jsp file, you should do these :
download the Liferay source, and add the portal-trunk as a Liferay Project in Eclipse
Navigate through the portal to your desired file (manage my account), and get the url from your browser
Search for the "struts_action" attribute in the usl. For this case, it's "/my_sites/view"
This is very helpful as the first parameter indicates the portlet that controls the jsp page.
The second parameter usually is the jsp you are searching for
Find that file in the portal trunk and search for the html component you want to edit. it might be in the page itself, or it could be on an included one, or a sibling one (provided as a tab)
For your case, it's "/portal-trunk/portal-web/docroot/html/portlet/users_admin/edit_user.jsp"
It is not possible to remove those options using CSS. We can do the following simple java code for removing those tabs... The page which we need to edit is "/portal-trunk/portal-web/docroot/html/portlet/users_admin/edit_user.jsp".
List<String> identificationList = new ArrayList<String>();
for(String identificationItem : identificationSections){
identificationList.add(identificationItem);
System.out.println(identificationItem);
}
identificationList.remove("websites");
identificationList.remove("instant-messenger");
identificationList.remove("social-network");
identificationList.remove("sms");
identificationList.remove("open-id");
identificationSections = new String[identificationList.size()];
for(int i = 0; i < identificationList.size(); i++){
identificationSections[i] =identificationList.get(i);
}
Its easy to hide those links by using the simple java code written above.