added manager user type
This commit is contained in:
@@ -129,12 +129,16 @@
|
||||
<div class="absolute left-0 bottom-full mb-2 hidden group-hover:block bg-gray-800 text-white text-xs rounded py-1 px-2 w-48">
|
||||
Admin users have full access to manage contacts and system settings.
|
||||
</div>
|
||||
{% if is_last_admin and form.is_admin.data %}
|
||||
<div class="ml-2 text-sm text-amber-600">
|
||||
<i class="fas fa-exclamation-circle"></i>
|
||||
You are the only admin
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="flex items-center relative group">
|
||||
{{ form.is_manager(
|
||||
class="h-4 w-4 focus:ring-blue-500 border-gray-300 rounded",
|
||||
style="accent-color: #16767b;"
|
||||
) }}
|
||||
{{ form.is_manager.label(class="ml-2 block text-sm text-gray-900") }}
|
||||
<div class="absolute left-0 bottom-full mb-2 hidden group-hover:block bg-gray-800 text-white text-xs rounded py-1 px-2 w-48">
|
||||
Manager users have similar permissions to admins but with some restrictions.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if form.is_admin.errors %}
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
<select name="role" class="px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-200">
|
||||
<option value="">All Roles</option>
|
||||
<option value="admin" {% if request.args.get('role') == 'admin' %}selected{% endif %}>Admin</option>
|
||||
<option value="manager" {% if request.args.get('role') == 'manager' %}selected{% endif %}>Manager</option>
|
||||
<option value="user" {% if request.args.get('role') == 'user' %}selected{% endif %}>User</option>
|
||||
</select>
|
||||
<button type="button" id="clearFilters" class="px-4 py-2 rounded-lg text-white font-medium transition-colors duration-200"
|
||||
@@ -99,9 +100,9 @@
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<div class="flex flex-row flex-wrap gap-1.5">
|
||||
<span class="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-sm font-medium"
|
||||
style="background-color: {% if user.is_admin %}rgba(147,51,234,0.1){% else %}rgba(107,114,128,0.1){% endif %}; color: {% if user.is_admin %}#7e22ce{% else %}#374151{% endif %};">
|
||||
<i class="fas fa-{% if user.is_admin %}shield-alt{% else %}user{% endif %}" style="font-size: 0.85em; opacity: 0.7;"></i>
|
||||
{{ 'Admin' if user.is_admin else 'User' }}
|
||||
style="background-color: {% if user.is_admin %}rgba(147,51,234,0.1){% elif user.is_manager %}rgba(59,130,246,0.1){% else %}rgba(107,114,128,0.1){% endif %}; color: {% if user.is_admin %}#7e22ce{% elif user.is_manager %}#2563eb{% else %}#374151{% endif %};">
|
||||
<i class="fas fa-{% if user.is_admin %}shield-alt{% elif user.is_manager %}user-tie{% else %}user{% endif %}" style="font-size: 0.85em; opacity: 0.7;"></i>
|
||||
{{ 'Admin' if user.is_admin else 'Manager' if user.is_manager else 'User' }}
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
<h5 class="card-title mb-0">
|
||||
<i class="fas fa-users me-2"></i>Members
|
||||
</h5>
|
||||
{% if current_user.is_admin %}
|
||||
{% if current_user.is_admin or current_user.is_manager %}
|
||||
<button type="button" class="btn btn-primary btn-sm" data-bs-toggle="modal" data-bs-target="#manageMembersModal">
|
||||
<i class="fas fa-user-edit me-1"></i>Manage Members
|
||||
</button>
|
||||
@@ -133,7 +133,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if current_user.is_admin %}
|
||||
{% if current_user.is_admin or current_user.is_manager %}
|
||||
<!-- Manage Members Modal -->
|
||||
<div class="modal fade" id="manageMembersModal" tabindex="-1" aria-labelledby="manageMembersModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
{{ header(
|
||||
title="Conversations",
|
||||
description="Manage your conversations and messages",
|
||||
button_text="New Conversation" if current_user.is_admin else "",
|
||||
button_url=url_for('conversations.create_conversation') if current_user.is_admin else "",
|
||||
button_text="New Conversation" if current_user.is_admin or current_user.is_manager else "",
|
||||
button_url=url_for('conversations.create_conversation') if current_user.is_admin or current_user.is_manager else "",
|
||||
icon="fa-comments",
|
||||
button_icon="fa-plus"
|
||||
) }}
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
<!-- Storage Section -->
|
||||
<div class="mb-4">
|
||||
<h2 class="section-title">Storage Overview</h2>
|
||||
{% if current_user.is_admin %}
|
||||
{% if current_user.is_admin or current_user.is_manager %}
|
||||
{{ usage_limits(usage_stats) }}
|
||||
{% endif %}
|
||||
<div class="masonry">
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<h5 class="mb-0">Files</h5>
|
||||
</div>
|
||||
<div class="d-flex gap-2" id="actionButtonsRow">
|
||||
{% if current_user.is_admin %}
|
||||
{% if current_user.is_admin or (current_user.is_manager and room.member_permissions|selectattr('user_id', 'equalto', current_user.id)|list|length > 0) %}
|
||||
<a href="{{ url_for('rooms.room_members', room_id=room.id) }}"
|
||||
class="btn btn-outline-primary d-flex align-items-center gap-2"
|
||||
style="border-color:var(--primary-color); color:var(--primary-color);"
|
||||
@@ -55,7 +55,7 @@
|
||||
<i class="fas fa-users"></i> Manage Members
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if current_user.is_admin or can_upload %}
|
||||
{% if current_user.is_admin or (current_user.is_manager and room.member_permissions|selectattr('user_id', 'equalto', current_user.id)|list|length > 0) or can_upload %}
|
||||
<button type="button" id="newFolderBtn" class="btn btn-outline-primary d-flex align-items-center gap-2"
|
||||
style="border-color:var(--primary-color); color:var(--primary-color);"
|
||||
onmouseover="this.style.backgroundColor='var(--primary-color)'; this.style.color='white'"
|
||||
@@ -72,7 +72,7 @@
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% if current_user.is_admin or can_download %}
|
||||
{% if current_user.is_admin or (current_user.is_manager and room.member_permissions|selectattr('user_id', 'equalto', current_user.id)|list|length > 0) or can_download %}
|
||||
<button id="downloadSelectedBtn" class="btn btn-outline-primary btn-sm d-flex align-items-center gap-2"
|
||||
style="display:none; border-color:var(--primary-color); color:var(--primary-color);"
|
||||
onmouseover="this.style.backgroundColor='var(--primary-color)'; this.style.color='white'"
|
||||
@@ -80,7 +80,7 @@
|
||||
<i class="fas fa-download"></i> Download Selected
|
||||
</button>
|
||||
{% endif %}
|
||||
{% if current_user.is_admin or can_delete %}
|
||||
{% if current_user.is_admin or (current_user.is_manager and room.member_permissions|selectattr('user_id', 'equalto', current_user.id)|list|length > 0) or can_delete %}
|
||||
<button id="deleteSelectedBtn" class="btn btn-outline-danger btn-sm d-flex align-items-center gap-2"
|
||||
style="display:none; border-color:var(--danger-color); color:var(--danger-color);"
|
||||
onmouseover="this.style.backgroundColor='var(--danger-color)'; this.style.color='white'"
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
<a href="{{ url_for('rooms.room', room_id=room.id) }}" class="btn btn-primary flex-grow-1">
|
||||
<i class="fas fa-door-open me-2"></i>Open Room
|
||||
</a>
|
||||
{% if current_user.is_admin %}
|
||||
{% if current_user.is_admin or (current_user.is_manager and room.member_permissions|selectattr('user_id', 'equalto', current_user.id)|list|length > 0) %}
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-secondary dropdown-toggle" type="button" id="roomActions{{ room.id }}" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<i class="fas fa-ellipsis-v"></i>
|
||||
@@ -93,7 +93,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if current_user.is_admin %}
|
||||
{% if current_user.is_admin or (current_user.is_manager and room.member_permissions|selectattr('user_id', 'equalto', current_user.id)|list|length > 0) %}
|
||||
<!-- Delete Room Modal -->
|
||||
<div class="modal fade" id="deleteRoomModal{{ room.id }}" tabindex="-1" aria-labelledby="deleteRoomModalLabel{{ room.id }}" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
|
||||
Reference in New Issue
Block a user