submissions: introduce special roles to create submissions you do not own

This commit is contained in:
Quaternions 2025-04-01 16:16:29 -07:00
parent 035393ce76
commit ab8690270c
Signed by: Quaternions
GPG Key ID: D0DF5964F79AC131

@ -17,6 +17,9 @@ var (
// Submissions roles bitflag
type Roles int32
var (
// Only users with this role are allowed to submit models they don't own
RolesSubmissionCreateNotModelOwner Roles = 1<<8
RolesMapfixCreateNotModelOwner Roles = 1<<7
RolesSubmissionUpload Roles = 1<<6
RolesSubmissionReview Roles = 1<<5
RolesSubmissionRelease Roles = 1<<4
@ -130,6 +133,12 @@ func (usr UserInfoHandle) GetRoles() (Roles, error) {
}
// RoleThumbnail
func (usr UserInfoHandle) HasRoleMapfixCreateNotModelOwner() (bool, error) {
return usr.hasRoles(RolesMapfixCreateNotModelOwner)
}
func (usr UserInfoHandle) HasRoleSubmissionCreateNotModelOwner() (bool, error) {
return usr.hasRoles(RolesSubmissionCreateNotModelOwner)
}
func (usr UserInfoHandle) HasRoleMapfixUpload() (bool, error) {
return usr.hasRoles(RolesMapfixUpload)
}