More work on the api. Also auth middleware stuff
More work on the placeholder functions for the Linstrom API Additionally, started work on a slightly more sophisticated authentication control system And ran `go generate` again
This commit is contained in:
parent
b9c95a0297
commit
873f52d64f
14 changed files with 637 additions and 300 deletions
|
@ -6,6 +6,8 @@ import (
|
|||
"gitlab.com/mstarongitlab/goutils/other"
|
||||
)
|
||||
|
||||
// Default role every user has. Defines sane defaults for a normal user
|
||||
// Will get overwritten by just about every other role due to every other role having higher priority
|
||||
var DefaultUserRole = Role{
|
||||
Name: "Default",
|
||||
Priority: 0,
|
||||
|
@ -19,10 +21,13 @@ var DefaultUserRole = Role{
|
|||
CanSendLocalNotes: other.IntoPointer(true),
|
||||
CanSendFollowerOnlyNotes: other.IntoPointer(true),
|
||||
CanSendPrivateNotes: other.IntoPointer(true),
|
||||
CanSendReplies: other.IntoPointer(true),
|
||||
CanQuote: other.IntoPointer(true),
|
||||
CanBoost: other.IntoPointer(true),
|
||||
CanIncludeLinks: other.IntoPointer(true),
|
||||
CanIncludeSurvey: other.IntoPointer(true),
|
||||
CanFederateFedi: other.IntoPointer(true),
|
||||
CanFederateBsky: other.IntoPointer(true),
|
||||
|
||||
CanChangeDisplayName: other.IntoPointer(true),
|
||||
|
||||
|
@ -32,7 +37,9 @@ var DefaultUserRole = Role{
|
|||
|
||||
CanMentionOthers: other.IntoPointer(true),
|
||||
HasMentionCountLimit: other.IntoPointer(false),
|
||||
MentionLimit: other.IntoPointer(uint32(math.MaxUint32)), // Set this to max, even if not used due to *HasMentionCountLimit == false
|
||||
MentionLimit: other.IntoPointer(
|
||||
uint32(math.MaxUint32),
|
||||
), // Set this to max, even if not used due to *HasMentionCountLimit == false
|
||||
|
||||
AutoNsfwMedia: other.IntoPointer(false),
|
||||
AutoCwPosts: other.IntoPointer(false),
|
||||
|
@ -59,7 +66,8 @@ var DefaultUserRole = Role{
|
|||
CanSendAnnouncements: other.IntoPointer(false),
|
||||
}
|
||||
|
||||
var fullAdminRole = Role{
|
||||
// Role providing maximum permissions
|
||||
var FullAdminRole = Role{
|
||||
Name: "fullAdmin",
|
||||
Priority: math.MaxUint,
|
||||
IsUserRole: false,
|
||||
|
@ -85,7 +93,9 @@ var fullAdminRole = Role{
|
|||
|
||||
CanMentionOthers: other.IntoPointer(true),
|
||||
HasMentionCountLimit: other.IntoPointer(false),
|
||||
MentionLimit: other.IntoPointer(uint32(math.MaxUint32)), // Set this to max, even if not used due to *HasMentionCountLimit == false
|
||||
MentionLimit: other.IntoPointer(
|
||||
uint32(math.MaxUint32),
|
||||
), // Set this to max, even if not used due to *HasMentionCountLimit == false
|
||||
|
||||
AutoNsfwMedia: other.IntoPointer(false),
|
||||
AutoCwPosts: other.IntoPointer(false),
|
||||
|
@ -112,7 +122,67 @@ var fullAdminRole = Role{
|
|||
CanSendAnnouncements: other.IntoPointer(true),
|
||||
}
|
||||
|
||||
// Role for totally freezing an account, blocking all activity from it
|
||||
var AccountFreezeRole = Role{
|
||||
Name: "accountFreeze",
|
||||
Priority: math.MaxUint - 1,
|
||||
IsUserRole: false,
|
||||
IsBuiltIn: true,
|
||||
|
||||
CanSendMedia: other.IntoPointer(false),
|
||||
CanSendCustomEmotes: other.IntoPointer(false),
|
||||
CanSendCustomReactions: other.IntoPointer(false),
|
||||
CanSendPublicNotes: other.IntoPointer(false),
|
||||
CanSendLocalNotes: other.IntoPointer(false),
|
||||
CanSendFollowerOnlyNotes: other.IntoPointer(false),
|
||||
CanSendPrivateNotes: other.IntoPointer(false),
|
||||
CanSendReplies: other.IntoPointer(false),
|
||||
CanQuote: other.IntoPointer(false),
|
||||
CanBoost: other.IntoPointer(false),
|
||||
CanIncludeLinks: other.IntoPointer(false),
|
||||
CanIncludeSurvey: other.IntoPointer(false),
|
||||
CanFederateBsky: other.IntoPointer(false),
|
||||
CanFederateFedi: other.IntoPointer(false),
|
||||
|
||||
CanChangeDisplayName: other.IntoPointer(false),
|
||||
|
||||
BlockedUsers: []string{},
|
||||
CanSubmitReports: other.IntoPointer(false),
|
||||
CanLogin: other.IntoPointer(false),
|
||||
|
||||
CanMentionOthers: other.IntoPointer(false),
|
||||
HasMentionCountLimit: other.IntoPointer(false),
|
||||
MentionLimit: other.IntoPointer(
|
||||
uint32(math.MaxUint32),
|
||||
), // Set this to max, even if not used due to *HasMentionCountLimit == false
|
||||
|
||||
AutoNsfwMedia: other.IntoPointer(true),
|
||||
AutoCwPosts: other.IntoPointer(false),
|
||||
AutoCwPostsText: other.IntoPointer("Account frozen"),
|
||||
WithholdNotesForManualApproval: other.IntoPointer(true),
|
||||
ScanCreatedPublicNotes: other.IntoPointer(false),
|
||||
ScanCreatedLocalNotes: other.IntoPointer(false),
|
||||
ScanCreatedFollowerOnlyNotes: other.IntoPointer(false),
|
||||
ScanCreatedPrivateNotes: other.IntoPointer(false),
|
||||
DisallowInteractionsWith: []string{},
|
||||
|
||||
FullAdmin: other.IntoPointer(false),
|
||||
CanAffectOtherAdmins: other.IntoPointer(false),
|
||||
CanDeleteNotes: other.IntoPointer(false),
|
||||
CanConfirmWithheldNotes: other.IntoPointer(false),
|
||||
CanAssignRoles: other.IntoPointer(false),
|
||||
CanSupressInteractionsBetweenUsers: other.IntoPointer(false),
|
||||
CanOverwriteDisplayNames: other.IntoPointer(false),
|
||||
CanManageCustomEmotes: other.IntoPointer(false),
|
||||
CanViewDeletedNotes: other.IntoPointer(false),
|
||||
CanRecoverDeletedNotes: other.IntoPointer(false),
|
||||
CanManageAvatarDecorations: other.IntoPointer(false),
|
||||
CanManageAds: other.IntoPointer(false),
|
||||
CanSendAnnouncements: other.IntoPointer(false),
|
||||
}
|
||||
|
||||
var allDefaultRoles = []*Role{
|
||||
&DefaultUserRole,
|
||||
&fullAdminRole,
|
||||
&FullAdminRole,
|
||||
&AccountFreezeRole,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue