|
2129 | 2129 | </div>
|
2130 | 2130 | <div class="header-right">
|
2131 | 2131 | {% if username %}
|
2132 |
| - <button id="register-server-button" class="secondary-button" style="margin-right: 10px; padding: 8px 16px; font-weight: 600; border-radius: 8px;">Register Server</button> |
| 2132 | + {% if user_context.can_modify_servers %} |
| 2133 | + <button id="register-server-button" class="secondary-button" style="margin-right: 10px; padding: 8px 16px; font-weight: 600; border-radius: 8px;">Register Server</button> |
| 2134 | + {% endif %} |
2133 | 2135 | {% endif %}
|
2134 | 2136 | <button id="theme-toggle" class="theme-toggle-button" title="Toggle Theme">🌙</button>
|
2135 |
| - <span class="user-display">User: {{ username }}</span> |
| 2137 | + <div class="user-display" style="display: flex; flex-direction: column; align-items: flex-end; margin-right: 15px;"> |
| 2138 | + <span style="font-weight: bold;">{{ username }}</span> |
| 2139 | + <span style="font-size: 0.8em; opacity: 0.8;"> |
| 2140 | + {% if user_context.is_admin %} |
| 2141 | + 🔑 Admin Access |
| 2142 | + {% elif user_context.can_modify_servers %} |
| 2143 | + ⚙️ Modify Access |
| 2144 | + {% else %} |
| 2145 | + 👁️ Read-only Access |
| 2146 | + {% endif %} |
| 2147 | + {% if user_context.auth_method == 'oauth2' %} |
| 2148 | + ({{ user_context.provider | title }}) |
| 2149 | + {% endif %} |
| 2150 | + </span> |
| 2151 | + {% if not user_context.is_admin %} |
| 2152 | + <span style="font-size: 0.7em; opacity: 0.7;" title="Servers you have access to: {{ user_context.accessible_servers | join(', ') }}"> |
| 2153 | + Access: {{ user_context.accessible_servers | length }} server(s) |
| 2154 | + </span> |
| 2155 | + {% endif %} |
| 2156 | + </div> |
2136 | 2157 | <form action="/logout" method="post" style="display: inline;">
|
2137 | 2158 | <button type="submit" class="logout-button">Logout</button>
|
2138 | 2159 | </form>
|
@@ -2271,24 +2292,32 @@ <h2>{{ service.display_name }}</h2>
|
2271 | 2292 | </div>
|
2272 | 2293 |
|
2273 | 2294 | <div class="controls-row">
|
2274 |
| - <a href="/edit{{ service.path }}" class="edit-button">Modify</a> |
2275 |
| - {# Add ID to form if needed, but action URL is sufficient #} |
2276 |
| - <form action="/toggle{{ service.path }}" method="post" class="toggle-form"> |
2277 |
| - <label class="switch"> |
2278 |
| - {# Change onchange to use data attributes instead #} |
2279 |
| - <input type="checkbox" name="enabled" value="on" |
2280 |
| - id="{{ 'toggle-check-' + safe_path }}" |
2281 |
| - {% if service.is_enabled %}checked{% endif %} |
2282 |
| - data-path="{{ service.path }}" |
2283 |
| - class="toggle-checkbox"> |
2284 |
| - <span class="slider round"></span> |
2285 |
| - </label> |
2286 |
| - {# Add ID to label span #} |
2287 |
| - <span id="{{ 'toggle-label-' + safe_path }}" class="toggle-label"> |
2288 |
| - {{ 'Enabled' if service.is_enabled else 'Disabled' }} |
2289 |
| - </span> |
2290 |
| - </form> |
2291 |
| - |
| 2295 | + {% if user_context.can_modify_servers %} |
| 2296 | + <a href="/edit{{ service.path }}" class="edit-button">Modify</a> |
| 2297 | + {# Add ID to form if needed, but action URL is sufficient #} |
| 2298 | + <form action="/toggle{{ service.path }}" method="post" class="toggle-form"> |
| 2299 | + <label class="switch"> |
| 2300 | + {# Change onchange to use data attributes instead #} |
| 2301 | + <input type="checkbox" name="enabled" value="on" |
| 2302 | + id="{{ 'toggle-check-' + safe_path }}" |
| 2303 | + {% if service.is_enabled %}checked{% endif %} |
| 2304 | + data-path="{{ service.path }}" |
| 2305 | + class="toggle-checkbox"> |
| 2306 | + <span class="slider round"></span> |
| 2307 | + </label> |
| 2308 | + {# Add ID to label span #} |
| 2309 | + <span id="{{ 'toggle-label-' + safe_path }}" class="toggle-label"> |
| 2310 | + {{ 'Enabled' if service.is_enabled else 'Disabled' }} |
| 2311 | + </span> |
| 2312 | + </form> |
| 2313 | + {% else %} |
| 2314 | + {# Read-only users: just show status without any controls #} |
| 2315 | + <div class="read-only-status"> |
| 2316 | + <span class="status-text" title="Read-only access - you cannot modify this server"> |
| 2317 | + 📖 {{ 'Enabled' if service.is_enabled else 'Disabled' }} (Read-only) |
| 2318 | + </span> |
| 2319 | + </div> |
| 2320 | + {% endif %} |
2292 | 2321 | </div>
|
2293 | 2322 | </div>
|
2294 | 2323 | <div class="card-footer">
|
|
0 commit comments