@ddj-v2/user-management 2.4.1 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -27,7 +27,6 @@ pm2 restart hydrooj
27
27
  6. **封鎖使用者**:在「使用者狀態」部分封鎖或解封使用者
28
28
 
29
29
 
30
- 1. **域用戶管理**: 可看見 default role
31
30
  ## 權限說明
32
31
 
33
32
  插件使用以下權限等級:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ddj-v2/user-management",
3
- "version": "2.4.1",
3
+ "version": "2.6.0",
4
4
  "description": "Advanced user management plugin for Hydro",
5
5
  "main": "index.ts",
6
6
  "author": "Grass_cat",
@@ -1,5 +1,6 @@
1
1
  {% import "components/user.html" as user with context %}
2
2
  {% import "components/sidemenu.html" as sidemenu with context %}
3
+ {% import "components/paginator.html" as paginator with context %}
3
4
  {% extends "manage_base.html" %}
4
5
 
5
6
  {% block manage_content %}
@@ -125,7 +126,7 @@
125
126
  <div class="section__body">
126
127
  <div class="row">
127
128
  <div class="columns">
128
- {% include "components/paginator.html" %}
129
+ {{ paginator.render(page, upcount) }}
129
130
  </div>
130
131
  </div>
131
132
  </div>
@@ -1,109 +0,0 @@
1
- {% extends "domain_base.html" %}
2
- {% block domain_content %}
3
- {{ set(UiContext, 'roles', roles.map(eval('(i) => i._id'))) }}
4
- {{ set(UiContext, 'canForceJoin', model.system.get('server.allowInvite') or handler.user.hasPriv(PRIV.PRIV_MANAGE_ALL_DOMAIN)) }}
5
- {% set _rolesSelect = roles.filter(eval("(i) => i._id !== 'guest'")).map(eval('(role) => [role._id, role._id]')) %}
6
- <div class="section">
7
- <div class="section__header">
8
- <h1 class="section__title">{{ _('{0}: Users').format(domain.name) }}</h1>
9
- <div class="section__tools">
10
- <button class="primary rounded button" name="add_user">{{ _('Add User') }}</button>
11
- </div>
12
- <!-- Search bar for Role -->
13
- <div class="section__search" style="margin-top: 10px;">
14
- <input type="text" id="roleSearch" placeholder="{{ _('Search by Role') }}" class="input" style="width: 200px;">
15
- </div>
16
- </div>
17
- {{ noscript_note.render() }}
18
- <div class="section__body no-padding domain-users">
19
- <table class="data-table" id="userTable">
20
- <colgroup>
21
- <col class="col--checkbox">
22
- <col class="col--uid">
23
- <col class="col--user">
24
- <col class="col--role">
25
- </colgroup>
26
- <thead>
27
- <tr>
28
- <th class="col--checkbox">
29
- <label class="compact checkbox">
30
- <input type="checkbox" name="select_all" data-checkbox-toggle="user">
31
- </label>
32
- </th>
33
- <th class="col--uid">{{ _('User ID') }}</th>
34
- <th class="col--user">{{ _('Username') }}</th>
35
- <th class="col--role">{{ _('Role') }}</th>
36
- </tr>
37
- </thead>
38
- <tbody>
39
- {%- for role, udocs in rudocs -%}
40
- {%- if udocs|length > 50 -%}
41
- <tr data-role="{{ role }}">
42
- <td colspan="3" style="text-wrap: wrap;"><div style="max-height: 300px; overflow-y: auto">
43
- {%- for udoc in udocs -%}
44
- {% set is_disabled=(rudoc._id == handler.user._id) %}
45
- <input type="checkbox" data-uid="{{udoc._id}}" data-checkbox-group="user" {% if is_disabled %}disabled{% else %}data-checkbox-range{% endif %}>
46
- [{{udoc._id}}]{{ user.render_inline(udoc, avatar=false, badge=false) }}{% if not udoc.join %}
47
- <span class="not-joined">({{ _('Not joined yet') }})</span>
48
- {% endif %}&nbsp;&nbsp;&nbsp;
49
- {%- endfor -%}
50
- </div></td>
51
- <td>{{ role }}</td>
52
- </tr>
53
- {%- else -%}
54
- {%- for rudoc in udocs -%}
55
- {% set is_disabled=(rudoc._id == handler.user._id) %}
56
- <tr data-role="{{ rudoc.role }}" data-uid="{{ rudoc._id }}">
57
- <td class="col--checkbox">
58
- <label class="compact checkbox">
59
- <input type="checkbox" data-checkbox-group="user" {% if is_disabled %}disabled{% else %}data-checkbox-range{% endif %}>
60
- </label>
61
- </td>
62
- <td class="col--uid">
63
- {{ rudoc._id }}
64
- </td>
65
- <td class="col--user">
66
- {{ user.render_inline(rudoc, badge=false) }}
67
- {% if not rudoc.join %}<span class="text-orange">({{ _('Not joined yet') }})</span>{% endif %}
68
- </td>
69
- <td class="col--role">
70
- {{ form.select({
71
- options:_rolesSelect,
72
- name:'role',
73
- value:rudoc.role,
74
- extra_class:'compact',
75
- disabled:is_disabled
76
- }) }}
77
- </td>
78
- </tr>
79
- {%- endfor -%}
80
- {%- endif -%}
81
- {%- endfor -%}
82
- </tbody>
83
- </table>
84
- </div>
85
- <div class="section__body">
86
- <button class="rounded button" name="remove_selected">{{ _('Remove Selected User') }}</button>
87
- <button class="rounded button" name="set_roles">{{ _('Set Roles for Selected User') }}</button>
88
- </div>
89
- </div>
90
- <script>
91
- document.addEventListener('DOMContentLoaded', function() {
92
- var searchInput = document.getElementById('roleSearch');
93
- searchInput.addEventListener('input', function() {
94
- var filter = searchInput.value.toLowerCase();
95
- var rows = document.querySelectorAll('#userTable tbody tr');
96
- rows.forEach(function(row) {
97
- var role = row.getAttribute('data-role');
98
- if (role && role.toLowerCase().indexOf(filter) !== -1) {
99
- row.style.display = '';
100
- } else if (filter === '') {
101
- row.style.display = '';
102
- } else {
103
- row.style.display = 'none';
104
- }
105
- });
106
- });
107
- });
108
- </script>
109
- {% endblock %}