oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package setup
2
3import (
4 "errors"
5 "gorm.io/gorm"
6)
7
8func CurrentOwner(tx *gorm.DB, actor Actor, member func(*gorm.DB, string) (Member, error), notFound, forbidden error) error {
9 row, err := member(tx, actor.Address)
10 if errors.Is(err, notFound) {
11 return forbidden
12 }
13 if err != nil {
14 return err
15 }
16 if !row.Active || row.Role != RoleOwner {
17 return forbidden
18 }
19 return nil
20}
21