3
I have a menu in my application, but I need to add a configuration screen where the system administrator selects the menu and chooses whether to enable or disable the menu item, for all users of the application.
I thought to create a table with the menu items and check whether they are enabled or not (0 or 1), and show only those that are enabled.
I have never worked with this type of configuration and I don’t know if this medium I described is the "correct" way or if it works.
Could someone help me with the right logic to develop this configuration?
Menu
<div class="container">
    <br />
    <!-- Static navbar -->
    <nav class="navbar navbar-default" role="navigation">
        <div class="container-fluid">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
            </div>
            <div id="navbar" class="navbar-collapse collapse">
                <ul class="nav navbar-nav">
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Informações<span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li>@Html.ActionLink("Afastamentos", "Index", "Afastamento")</li>
                            <li>@Html.ActionLink("Aniversariantes", "Aniversariantes", "Usuario")</li>
                            <li>@Html.ActionLink("Dados Cadastrais", "Index", "Usuario")</li>
                            <li>@Html.ActionLink("Dependentes", "Dependente", "Usuario")</li>
                            <li>@Html.ActionLink("Férias", "Ferias", "Usuario")</li>
                        </ul>
                    </li>
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Requerimentos<span class="caret"></span></a>
                        <ul class="dropdown-menu">
                                    <li>@Html.ActionLink("Todos", "Index", "Requerimento")</li>
                            <li>@Html.ActionLink("Meus Requerimentos", "MeusRequerimentos", "Requerimento")</li>
                            <li>@Html.ActionLink("Aposentadoria", "Aposentadoria", "Requerimento")</li>
                            <li>@Html.ActionLink("Averbação", "Averbacao", "Requerimento")</li>
                            <li>@Html.ActionLink("Certidão de Tempo de Serviço", "CertidaoTempo", "Requerimento")</li>
                            <li>@Html.ActionLink("Exoneração", "Exoneracao", "Requerimento")</li>
                            <li>@Html.ActionLink("Férias", "Ferias", "Requerimento")</li>
                            <li>@Html.ActionLink("Mudança de Nivel", "Nivel", "Requerimento")</li>
                            <li>@Html.ActionLink("Outros", "Outros", "Requerimento")</li>
                        </ul>
                    </li>
                    {
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">Usuários<span class="caret"></span></a>
                            <ul class="dropdown-menu">
                                <li>@Html.ActionLink("Cadastrar Novo", "Inserir", "Funcionario")</li>
                                <li>@Html.ActionLink("Listar", "Index", "Funcionario")</li>
                            </ul>
                        </li>
                    }
                    <li>
                        <a href="http://localhost/GPWEB/logado.asp">Contracheque<span></span></a>
                    </li>
                </ul>
            </div><!--/.nav-collapse -->
        </div><!--/.container-fluid -->
    </nav>
</div>
First of all, take a look at these responses that use the
Authorize. It can be interesting as a starting point. After that edit your question and leave it more specific.– Leonel Sanches da Silva
@Ciganomorrisonmendez I have always used Authorize, the problem is that I do not have access control for this application. I will only have one admin user, to enable or disable menus for the entire application.
– Randrade