> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/powershell-universal/es/aplicaciones/role-based-access.md).

# Acceso basado en roles

## Roles de aplicaciones

Cuando la autenticación de la aplicación está habilitada, puede definir el rol al que un usuario debe pertenecer para acceder al panel. Los roles se configuran en la página Configuración \ Seguridad o desde el fichero de configuración `roles.ps1`.

<figure><img src="/files/8AtUNbsJUJefMKbGl8f9" alt=""><figcaption><p>Seguridad de la aplicación</p></figcaption></figure>

Si un usuario intenta visitar una aplicación a la que no tiene acceso, se le mostrará una página de No autorizado.

![](/files/aRKWDkaUX1WXyrSlut2j)

## Roles de páginas

También puede mostrar u ocultar páginas según los roles. Para definir un rol para una página, utilice el parámetro `-Role` de `New-UDPage`. Solo los usuarios del rol especificado tendrán acceso a esta página.

```powershell
New-UDPage -Role 'Administrators' -Content {
    New-UDTypography -Text 'Admins only'
}
```

## Variable $Roles

Además de los roles de aplicaciones y páginas, también puede comprobar a qué roles pertenece un usuario utilizando la variable `$Roles` que está disponible dentro de las aplicaciones. Esta variable contiene una matriz de los roles asignados al usuario.

Por ejemplo, podría mostrar el botón `Restart-Computer` solo a los administradores.

```powershell
if ($Roles -contains "Administrator") {
    New-UDButton -Text 'Restart Server' -OnClick {
        Restart-Computer
    }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.devolutions.net/powershell-universal/es/aplicaciones/role-based-access.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
