{% extends "base.html" %} {% from "components/ui.html" import page_header, breadcrumb_nav, button, filter_badge %} {% block content %} {% set breadcrumbs = [ {'text': _('Admin'), 'url': url_for('admin.admin_dashboard')}, {'text': _('Roles & Permissions')} ] %} {{ page_header( icon_class='fas fa-shield-alt', title_text=_('Roles & Permissions'), subtitle_text=_('Manage roles and their permissions'), breadcrumbs=breadcrumbs, actions_html='' + '
{{ _('Total Roles') }}
{{ roles|length }}
{{ _('System Roles') }}
{{ roles|selectattr('is_system_role')|list|length }}
{{ _('Custom Roles') }}
{{ roles|rejectattr('is_system_role')|list|length }}
{{ _('Assigned Users') }}
{% set total_users = namespace(count=0) %} {% for role in roles %} {% set total_users.count = total_users.count + role.users.count() %} {% endfor %} {{ total_users.count }}
| {{ _('Role Name') }} | {{ _('Description') }} | {{ _('Permissions') }} | {{ _('Users') }} | {{ _('Type') }} | {{ _('Actions') }} |
|---|---|---|---|---|---|
|
{{ role.name }}
{% if role.is_system_role %}
{{ _('Default role') }}
{% endif %}
|
{{ role.description or '-' }} | {% set user_count = role.users.count() %} {% if user_count > 0 %} {{ user_count }} {{ _('user') if user_count == 1 else _('users') }} {% else %} {{ _('No users') }} {% endif %} | {% if role.is_system_role %} {{ _('System') }} {% else %} {{ _('Custom') }} {% endif %} |
{{ _('View') }}
{% if not role.is_system_role and (current_user.is_admin or has_permission('manage_roles')) %}
{{ _('Edit') }}
{% endif %}
|
|
{{ _('Permissions for') }} {{ role.name }}:{% set categories = {} %} {% for permission in role.permissions %} {% if permission.category not in categories %} {% set _ = categories.update({permission.category: []}) %} {% endif %} {% set _ = categories[permission.category].append(permission) %} {% endfor %} {% if categories %}
{% for category, perms in categories.items() %}
{% else %}
{{ category.replace('_', ' ') }}
{{ _('No permissions assigned.') }} {% endif %} |
|||||
| {{ _('No roles found.') }} | |||||
{{ _('Roles are collections of permissions that can be assigned to users. System roles are predefined and cannot be deleted or renamed, but custom roles can be created for your specific needs.') }}