dendrite/authorization/permissions.go
John Terzis 478579eea1 Jterzis/update dendrite (#656)
Pulls in upstream latest changes from [dendrite-fork
](https://github.com/HereNotThere/dendrite)to subtree at
servers/dendrite here.

Co-authored-by: Tak Wai Wong <64229756+tak-hntlabs@users.noreply.github.com>
Co-authored-by: Tak Wai Wong <tak@hntlabs.com>
Co-authored-by: John Terzis <john@hntlabs.com>
2022-10-17 15:59:47 -07:00

60 lines
1.4 KiB
Go

package authorization
type Permission int64
const (
// since iota starts with 0, the first value
// defined here will be the default
PermissionUndefined Permission = iota
PermissionRead
PermissionWrite
PermissionPing
PermissionInvite
PermissionRedact
PermissionBan
PermissionModifyChannelProfile
PermissionModifyChannelPermissions
PermissionPinMessages
PermissionAddRemoveChannels
PermissionModifySpacePermissions
PermissionModifyChannelDefaults
PermissionModifySpaceProfile
PermissionOwner
)
func (p Permission) String() string {
switch p {
case PermissionUndefined:
return "Undefined"
case PermissionRead:
return "Read"
case PermissionWrite:
return "Write"
case PermissionPing:
return "Ping"
case PermissionInvite:
return "Invite"
case PermissionRedact:
return "Redact"
case PermissionBan:
return "Ban"
case PermissionModifyChannelProfile:
return "ModifyChannelProfile"
case PermissionModifyChannelPermissions:
return "ModifyChannelPermissions"
case PermissionPinMessages:
return "PinMessages"
case PermissionAddRemoveChannels:
return "AddRemoveChannels"
case PermissionModifySpacePermissions:
return "ModifySpacePermissions"
case PermissionModifyChannelDefaults:
return "ModifyChannelDefaults"
case PermissionModifySpaceProfile:
return "ModifySpaceProfile"
case PermissionOwner:
return "Owner"
}
return "Unknown"
}