From ab8690270caeb8cef94676099853f348068f43b4 Mon Sep 17 00:00:00 2001
From: Quaternions <krakow20@gmail.com>
Date: Tue, 1 Apr 2025 16:16:29 -0700
Subject: [PATCH] submissions: introduce special roles to create submissions
 you do not own

---
 pkg/service/security.go | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/pkg/service/security.go b/pkg/service/security.go
index 71d147a..1964ff8 100644
--- a/pkg/service/security.go
+++ b/pkg/service/security.go
@@ -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)
 }