11 Replies Latest reply on Jan 30, 2014 6:09 AM by user1254328

    Navigation model





      we are using webcenter and we have created a navigation model. we have a Menu show up on home page. Menu derived from navigation model.


      what we want is - we want 5 Menus showup when logged in user is admin. If loggedin user is not admin, we want to show only 3 Menus. How can we achieve this (show - no show)  ?


      I see the source code and it is dynamically parsing the navigation model using node object. so how to put constraint ..   show / no show Menu depending on who has logged in.



        • 1. Re: Navigation model

          just to add - No,  I do not have any managed beans. Hoe can this be done without manage bean help. ?

          • 2. Re: Navigation model

            I am using this in the Menu commandLink...


            visible =   "#{WCSecurityContext.userInAppRole['Administrator']}"


            But the problem is it will show all Menus if Administrator is loggedin and  would show NO links if any other Role is loggedin. (so it is like ALL or None which is not what i need )  .     Plus I should be able to determine show 5 Menu and show 3 Menu depending on who has loggedin as described above.

            • 3. Re: Navigation model

              we used following in visible ...

              visible =   "#{WCSecurityContext.userInAppRole['Administrator']}"


              but this will show ALL Menus if  Administrator has logged in...  and  None if some other Role logs in.


              using expression lang how can we show 3 Menus OR 5 Menus depending who has loggedin

              • 4. Re: Navigation model
                Daniel Merchán



                Just concatenate conditions using AND, OR and ( ) operators to you're EL Expression.

                Use rendered property in your code instead of visible.


                With this way you're just hiding links and not protecting them. What I mean?. If the user knows the URL can have access to the page. You should apply also security to you're pages.



                • 5. Re: Navigation model
                  Alejandro Tovar Lanz

                  Hi User,


                  You need to use the visible property directly in your Navigation Model and not in the source code of the page itself. If you open your navigation model and select any of the menu, you will see a visible property. In there you can use either what Daniel said with AND OR () or && || ().



                  • 6. Re: Navigation model
                    Daniel Merchán

                    Alex is right.


                    I confuse talking about code with #{not node.navigable} that is another thing .


                    • 7. Re: Navigation model


                      guess any sample code wull help that can go in jspx page/template which renders menu.




                      if (Administrator) .....


                         Loop over node and show (visible) all menus


                      else if (Regular)


                        Loop over node and show only regular menus

                      • 8. Re: Navigation model
                        Alejandro Tovar Lanz

                        Yo don't need to iterate. Just apply the condition directly in the Navigation Model. Each link has a visible property, in there you put if administrator.

                        • 9. Re: Navigation model

                          I have default-navigation-model.xml open in Jdev and it has just Page Hierarchy on left which I cannot expand and  just a Visible check box on right pane with facility to add EL). But i cannot open individual pages on the left is prolem


                          I open pages.xml  and it does show me all the Page Hierarchy Page1  Page2  etc which I can select individually which is good part.... but only Visible checkbox on right (with no facility to add EL expressions.


                          am i missing something.

                          • 10. Re: Navigation model

                            In Jdev I dragged jspx one by one and added them into the default-navigation-model.xml alongside the Page Hierarchy node. also selected each page in navigation and SET Visible for Administrator  using EL.



                            Problem is - now when I run the page, I see duplicate Menus on rendered page ( Guess one is coming from Page Hierarchy and another one coming from the jspx that I dragged in default-navigation-model.xml. how to remove these duplicate menus ?



                            • 11. Re: Navigation model

                              It worked. Thx.