mirror of
https://github.com/PrivateCaptcha/PrivateCaptcha.git
synced 2026-02-11 16:29:00 -06:00
Cosmetic improvement
This commit is contained in:
@@ -164,25 +164,26 @@ func (am *AuthMiddleware) Shutdown() {
|
||||
// we cache properties and send owners down the background pipeline
|
||||
func (am *AuthMiddleware) backfillSitekeyImpl(ctx context.Context, batch map[string]uint) error {
|
||||
properties, err := am.Store.Impl().RetrievePropertiesBySitekey(ctx, batch, am.NegativeSitekeyThreshold)
|
||||
if err == nil {
|
||||
for _, p := range properties {
|
||||
if p.OrgOwnerID.Valid {
|
||||
am.UsersChan <- p.OrgOwnerID.Int32
|
||||
}
|
||||
if p.CreatorID.Valid && (!p.OrgOwnerID.Valid || (p.CreatorID.Int32 != p.OrgOwnerID.Int32)) {
|
||||
am.UsersChan <- p.CreatorID.Int32
|
||||
}
|
||||
if orgMembers, err := am.Store.Impl().RetrieveOrganizationUsers(ctx, p.OrgID.Int32); err == nil {
|
||||
for _, user := range orgMembers {
|
||||
am.UsersChan <- user.User.ID
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if err != nil {
|
||||
slog.ErrorContext(ctx, "Failed to retrieve properties by sitekey", "count", len(batch), common.ErrAttr(err))
|
||||
return err
|
||||
}
|
||||
|
||||
return err
|
||||
for _, p := range properties {
|
||||
if p.OrgOwnerID.Valid {
|
||||
am.UsersChan <- p.OrgOwnerID.Int32
|
||||
}
|
||||
if p.CreatorID.Valid && (!p.OrgOwnerID.Valid || (p.CreatorID.Int32 != p.OrgOwnerID.Int32)) {
|
||||
am.UsersChan <- p.CreatorID.Int32
|
||||
}
|
||||
if orgMembers, err := am.Store.Impl().RetrieveOrganizationUsers(ctx, p.OrgID.Int32); err == nil {
|
||||
for _, user := range orgMembers {
|
||||
am.UsersChan <- user.User.ID
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// we block users without a subscription and (re)cache users API keys to ensure smooth auth in /verify codepath
|
||||
|
||||
Reference in New Issue
Block a user