<%-- 
    Document   : menu
    Created on : 21.1.2018, 19:52:11
    Author     : themi
--%>

<%@page import="cz.csu.sdmx.web.security.User"%>
<%@page import="cz.csu.sdmx.constants.*"%>
<%@page import="cz.csu.sdmx.web.security.Permission"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<nav class="navbar navbar-inverse">
  <ul class="nav navbar-nav">
    <li><a href="<c:url value="<%=URL.VALIDATOR %>"/>" >Validate SDMX data</a></li>
    <li><a href="<c:url value="<%=URL.RESULTS_LIST %>"/>" >Validation results</a></li>
    <li class="dropdown">
        <a class="dropdown-toggle" data-toggle="dropdown" href="#">Conditions
        <span class="caret"></span></a>
        <ul class="dropdown-menu">
            <li><a href="<c:url value="<%=URL.CONDITION_ADD %>"/>">Add condiditon</a></li>
            <li><a href="<c:url value="<%=URL.CONDITIONS_IMPORT %>"/>">Import conditions</a></li>
            <li><a href="<c:url value="<%=URL.CONDITIONS %>"/>">Condition list</a></li>
        </ul>
    </li>
    <%
        boolean userPermission = false;
        User user = (User) session.getAttribute(SESSION.USER);
        if(user != null)
            userPermission = user.hasPermission(Permission.ADMINISTER_USERS);
        
        session.setAttribute("userPermission", userPermission);
    %>
    <c:if test="${userPermission}" >
        <li class="dropdown">
            <a class="dropdown-toggle" data-toggle="dropdown" href="#">Administration
            <span class="caret"></span></a>
            <ul class="dropdown-menu">
                <li><a href="<c:url value="<%=URL.ADD_USER %>"/>">Add User</a></li>
                <li><a href="<c:url value="<%=URL.USERS_SEARCH %>"/>">Search users</a></li>
            </ul>
        </li>
    </c:if>
  </ul>
</nav>