forked from rDrama/rDrama
add MODS_EVERY_GROUP perm for myself
parent
6a19132b4a
commit
5e4a843e8e
|
@ -499,6 +499,7 @@ PERMS = { # Minimum admin_level to perform action.
|
||||||
'SEE_GHOST_VOTES': 5,
|
'SEE_GHOST_VOTES': 5,
|
||||||
|
|
||||||
'MODS_EVERY_HOLE': 6,
|
'MODS_EVERY_HOLE': 6,
|
||||||
|
'MODS_EVERY_GROUP': 6,
|
||||||
}
|
}
|
||||||
|
|
||||||
FEATURES = {
|
FEATURES = {
|
||||||
|
|
|
@ -139,7 +139,7 @@ def group_approve(v:User, group_name, user_id):
|
||||||
group = g.db.get(Group, group_name)
|
group = g.db.get(Group, group_name)
|
||||||
if not group: abort(404)
|
if not group: abort(404)
|
||||||
|
|
||||||
if v.id != group.owner.id:
|
if v.id != group.owner.id and v.admin_level < PERMS['MODS_EVERY_GROUP']:
|
||||||
abort(403, f"Only the group owner (@{group.owner.username}) can approve applications!")
|
abort(403, f"Only the group owner (@{group.owner.username}) can approve applications!")
|
||||||
|
|
||||||
application = g.db.query(GroupMembership).filter_by(user_id=user_id, group_name=group.name).one_or_none()
|
application = g.db.query(GroupMembership).filter_by(user_id=user_id, group_name=group.name).one_or_none()
|
||||||
|
@ -164,7 +164,7 @@ def group_reject(v:User, group_name, user_id):
|
||||||
group = g.db.get(Group, group_name)
|
group = g.db.get(Group, group_name)
|
||||||
if not group: abort(404)
|
if not group: abort(404)
|
||||||
|
|
||||||
if v.id != group.owner.id:
|
if v.id != group.owner.id and v.admin_level < PERMS['MODS_EVERY_GROUP']:
|
||||||
abort(403, f"Only the group owner (@{group.owner.username}) can reject memberships!")
|
abort(403, f"Only the group owner (@{group.owner.username}) can reject memberships!")
|
||||||
|
|
||||||
membership = g.db.query(GroupMembership).filter_by(user_id=user_id, group_name=group.name).one_or_none()
|
membership = g.db.query(GroupMembership).filter_by(user_id=user_id, group_name=group.name).one_or_none()
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
<th>Applied on</th>
|
<th>Applied on</th>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if v.id == group.owner.id %}
|
{% if v.id == group.owner.id or v.admin_level >= PERMS['MODS_EVERY_GROUP'] %}
|
||||||
<th class="disable-sort-click"></th>
|
<th class="disable-sort-click"></th>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
<td id="time-{{membership.user_id}}" data-time="{{membership.created_utc}}"></td>
|
<td id="time-{{membership.user_id}}" data-time="{{membership.created_utc}}"></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if v.id == group.owner.id %}
|
{% if v.id == group.owner.id or v.admin_level >= PERMS['MODS_EVERY_GROUP'] %}
|
||||||
<td>
|
<td>
|
||||||
<div id="kick-{{membership.user_id}}" {% if name == 'applications' %}class="d-none"{% endif %}>
|
<div id="kick-{{membership.user_id}}" {% if name == 'applications' %}class="d-none"{% endif %}>
|
||||||
<button type="button" class="btn btn-primary btn-block" data-nonce="{{g.nonce}}" data-onclick="reject_membership(this,'{{group}}','{{membership.user_id}}')">Kick</button>
|
<button type="button" class="btn btn-primary btn-block" data-nonce="{{g.nonce}}" data-onclick="reject_membership(this,'{{group}}','{{membership.user_id}}')">Kick</button>
|
||||||
|
@ -75,7 +75,7 @@
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% if v.id == group.owner.id %}
|
{% if v.id == group.owner.id or v.admin_level >= PERMS['MODS_EVERY_GROUP'] %}
|
||||||
{{process_memberships(applications, 'applications')}}
|
{{process_memberships(applications, 'applications')}}
|
||||||
{{process_memberships(members, 'members')}}
|
{{process_memberships(members, 'members')}}
|
||||||
<script defer src="{{'js/group_members_owner.js' | asset}}"></script>
|
<script defer src="{{'js/group_members_owner.js' | asset}}"></script>
|
||||||
|
|
Loading…
Reference in New Issue