diff --git a/frontend/scss/components/badges.scss b/frontend/scss/components/badges.scss index 5285e3fb..2889fc5c 100644 --- a/frontend/scss/components/badges.scss +++ b/frontend/scss/components/badges.scss @@ -17,6 +17,11 @@ span { background-color: #e83e8c; } + &.badge-wm { + color: #fff; + background-color: #b19cd9; + } + &.badge-webmaster { color: #fff; background-color: #2196F3; diff --git a/migrations/versions/a243fac8a399_add_wiki_maintainers.py b/migrations/versions/a243fac8a399_add_wiki_maintainers.py new file mode 100644 index 00000000..ccd1427d --- /dev/null +++ b/migrations/versions/a243fac8a399_add_wiki_maintainers.py @@ -0,0 +1,24 @@ +"""Add Wiki Maintainers + +Revision ID: a243fac8a399 +Revises: 53768f0a4850 +Create Date: 2020-09-02 15:20:48.285910 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'a243fac8a399' +down_revision = '53768f0a4850' +branch_labels = None +depends_on = None + + +def upgrade(): + op.add_column('signature_upper', sa.Column('w_m', sa.Boolean(), nullable=False, server_default='f')) + + +def downgrade(): + op.drop_column('signature_upper', 'w_m') diff --git a/package.json b/package.json index f1a93e4e..b97168dd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "title": "CSH Packet", "name": "csh-packet", - "version": "3.5.0", + "version": "3.5.1", "description": "A web app implementation of the CSH introductory packet.", "bugs": { "url": "https://github.com/ComputerScienceHouse/packet/issues", diff --git a/packet/context_processors.py b/packet/context_processors.py index 935106b6..2e8d5c55 100644 --- a/packet/context_processors.py +++ b/packet/context_processors.py @@ -33,6 +33,8 @@ def get_roles(sig): out['rtp'] = 'RTP' if sig.three_da: out['three_da'] = '3DA' + if sig.w_m: + out['wm'] = 'Wiki Maintainer' if sig.webmaster: out['webmaster'] = 'Webmaster' if sig.c_m: diff --git a/packet/ldap.py b/packet/ldap.py index 02a38dc9..0f78e171 100644 --- a/packet/ldap.py +++ b/packet/ldap.py @@ -112,6 +112,14 @@ def ldap_get_constitutional_maintainers(): return [member.uid for member in _ldap_get_group_members('constitutional_maintainers')] +def ldap_get_wiki_maintainers(): + """ + All wiki maintainers + :return: A list of CSHMember instances + """ + return [member.uid for member in _ldap_get_group_members('wiki_maintainers')] + + def ldap_get_drink_admins(): """ All drink admins diff --git a/packet/models.py b/packet/models.py index 355a9976..b914d27f 100644 --- a/packet/models.py +++ b/packet/models.py @@ -144,6 +144,7 @@ class UpperSignature(db.Model): three_da = Column(Boolean, default=False, nullable=False) webmaster = Column(Boolean, default=False, nullable=False) c_m = Column(Boolean, default=False, nullable=False) + w_m = Column(Boolean, default=False, nullable=False) drink_admin = Column(Boolean, default=False, nullable=False) updated = Column(DateTime, default=datetime.now, onupdate=datetime.now, nullable=False) diff --git a/packet/utils.py b/packet/utils.py index a01a1e3e..0f979f8c 100644 --- a/packet/utils.py +++ b/packet/utils.py @@ -11,7 +11,7 @@ from packet.mail import send_start_packet_mail from packet.models import Freshman, FreshSignature, Packet, UpperSignature, MiscSignature from packet.ldap import ldap_get_member, ldap_is_intromember, ldap_is_evals, ldap_is_on_coop, \ - ldap_get_active_members, ldap_get_active_rtps, ldap_get_3das, ldap_get_webmasters, \ + ldap_get_active_members, ldap_get_active_rtps, ldap_get_3das, ldap_get_wiki_maintainers, ldap_get_webmasters, \ ldap_get_constitutional_maintainers, ldap_get_drink_admins, ldap_get_eboard_role from packet.notifications import packets_starting_notification, packet_starting_notification @@ -166,6 +166,7 @@ def create_new_packets(base_date: date, freshmen_list: dict): three_da = ldap_get_3das() webmaster = ldap_get_webmasters() c_m = ldap_get_constitutional_maintainers() + w_m = ldap_get_wiki_maintainers() drink = ldap_get_drink_admins() # Packet starting notifications @@ -186,6 +187,7 @@ def create_new_packets(base_date: date, freshmen_list: dict): sig.three_da = member.uid in three_da sig.webmaster = member.uid in webmaster sig.c_m = member.uid in c_m + sig.w_m = member.uid in w_m sig.drink_admin = member.uid in drink db.session.add(sig) @@ -205,6 +207,7 @@ def sync_with_ldap(): three_da = ldap_get_3das() webmaster = ldap_get_webmasters() c_m = ldap_get_constitutional_maintainers() + w_m = ldap_get_wiki_maintainers() drink = ldap_get_drink_admins() print('Applying updates to the DB...') @@ -216,6 +219,7 @@ def sync_with_ldap(): sig.three_da = sig.member in three_da sig.webmaster = sig.member in webmaster sig.c_m = sig.member in c_m + sig.w_m = sig.member in w_m sig.drink_admin = sig.member in drink # Migrate UpperSignatures that are from accounts that are not active anymore @@ -234,6 +238,7 @@ def sync_with_ldap(): sig.three_da = sig.member in three_da sig.webmaster = sig.member in webmaster sig.c_m = sig.member in c_m + sig.w_m = sig.member in w_m sig.drink_admin = sig.member in drink db.session.add(sig) @@ -247,6 +252,7 @@ def sync_with_ldap(): sig.three_da = sig.member in three_da sig.webmaster = sig.member in webmaster sig.c_m = sig.member in c_m + sig.w_m = sig.member in w_m sig.drink_admin = sig.member in drink db.session.add(sig)