Skip to content
This repository was archived by the owner on Jun 30, 2024. It is now read-only.

Commit bc2af41

Browse files
committed
Fix: is_author was missing
1 parent 529f9f1 commit bc2af41

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

rsmanage/rsmanage.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,22 @@ def peergroups(course):
10761076
click.echo(f"No Peer Groups found for {course}")
10771077

10781078

1079+
def is_author(config, userid):
1080+
engine = create_engine(config.dburl)
1081+
ed = engine.execute(
1082+
"""select id from auth_group where auth_group.role = 'author'"""
1083+
).first()
1084+
1085+
row = engine.execute(
1086+
f"""select * from auth_membership where user_id = {userid} and group_id = {ed.id}"""
1087+
).first()
1088+
1089+
if row:
1090+
return True
1091+
else:
1092+
return False
1093+
1094+
10791095
@cli.command()
10801096
@click.option("--book", help="document-id or basecourse")
10811097
@click.option("--author", help="username")
@@ -1145,7 +1161,7 @@ def addbookauthor(config, book, author, github):
11451161
).first()
11461162
auth_group_id = auth_row[0]
11471163

1148-
if not is_author:
1164+
if not is_author(config, a_row.id):
11491165
res = engine.execute(
11501166
f"""
11511167
insert into auth_membership

0 commit comments

Comments
 (0)