Skip to content

Commit 7057ce5

Browse files
Add read only role (#933)
1 parent 450b46a commit 7057ce5

File tree

5 files changed

+12
-1
lines changed

5 files changed

+12
-1
lines changed

frontend/src/graphql/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1502,6 +1502,7 @@ export enum RoleEnum {
15021502
MANAGE_INVITES = "MANAGE_INVITES",
15031503
MODIFY = "MODIFY",
15041504
READ = "READ",
1505+
READ_ONLY = "READ_ONLY",
15051506
VOTE = "VOTE",
15061507
}
15071508

graphql/schema/types/user.graphql

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ enum RoleEnum {
1212
"""May grant and rescind invite tokens and resind invite keys"""
1313
MANAGE_INVITES
1414
BOT
15+
READ_ONLY
1516
EDIT_TAGS
1617
}
1718

pkg/models/generated_exec.go

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/models/generated_models.go

+3-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/user/user.go

+6
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,12 @@ func PromoteUserVoteRights(fac models.Repo, userID uuid.UUID, threshold int) err
520520
return err
521521
}
522522

523+
for _, role := range roles.ToRoles() {
524+
if role == models.RoleEnumReadOnly {
525+
return nil
526+
}
527+
}
528+
523529
hasVote := false
524530
for _, role := range roles.ToRoles() {
525531
if role.Implies(models.RoleEnumVote) {

0 commit comments

Comments
 (0)