Skip to content

Commit

Permalink
Add Bancho privilege
Browse files Browse the repository at this point in the history
  • Loading branch information
xnyo committed Jul 20, 2019
1 parent dc7af19 commit 34f24b8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions common/privileges.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const (
PrivilegeBlog // can do pretty much anything to the blog, and the documentation.
PrivilegeAPIMeta // can do /meta API calls. basically means they can restart the API server.
PrivilegeBeatmap // rank/unrank beatmaps. also BAT when implemented
PrivilegeBancho // can log in to bancho and use the chat through the delta ws api
)

// Privileges is a bitwise enum of the privileges of an user's API key.
Expand All @@ -36,6 +37,7 @@ var privilegeString = [...]string{
"Blog",
"APIMeta",
"Beatmap",
"Bancho",
}

func (p Privileges) String() string {
Expand All @@ -62,6 +64,7 @@ var privilegeMustBe = [...]UserPrivileges{
AdminPrivilegeChatMod, // temporary?
AdminPrivilegeManageServer,
AdminPrivilegeAccessRAP | AdminPrivilegeManageBeatmap,
UserPrivilegeNormal,
}

// CanOnly removes any privilege that the user has requested to have, but cannot have due to their rank.
Expand All @@ -81,6 +84,7 @@ func (p Privileges) CanOnly(userPrivs UserPrivileges) Privileges {
var privilegeMap = map[string]Privileges{
"read_confidential": PrivilegeReadConfidential,
"write": PrivilegeWrite,
"bancho": PrivilegeBancho,
}

// OAuthPrivileges returns the equivalent in Privileges of a space-separated
Expand Down

0 comments on commit 34f24b8

Please sign in to comment.