> 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

Restrinja las apps y páginas de PowerShell Universal por rol, y utilice la variable Roles para mostrar componentes de forma condicional según la pertenencia a roles del usuario.

## Roles de apps

Cuando la autenticación de apps está habilitada, puede definir el rol del que un usuario debe formar parte para poder acceder al dashboard. Los roles se configuran en **Secure > Roles** o desde el fichero de configuración `roles.ps1`.

Si un usuario intenta visitar una app a la que no tiene acceso, se le mostrará una página Not Authorized.

## Roles de páginas

También puede mostrar u ocultar páginas en función de 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 apps y páginas, también puede comprobar de qué roles forma parte un usuario utilizando la variable `$Roles` que está disponible dentro de las Apps. Esta variable contiene un array con 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
    }
}
```

### Véase también

* [Devolutions Academy – Outline and authentication](https://academy.devolutions.net/student/activity/3542770-part-1-outline-and-authentication)


---

# 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.
