18 lines
422 B
Go
18 lines
422 B
Go
|
|
package copy_mission
|
||
|
|
|
||
|
|
import (
|
||
|
|
"context"
|
||
|
|
|
||
|
|
"haixun-backend/internal/library/authctx"
|
||
|
|
app "haixun-backend/internal/library/errors"
|
||
|
|
"haixun-backend/internal/library/errors/code"
|
||
|
|
)
|
||
|
|
|
||
|
|
func actorFrom(ctx context.Context) (tenantID, uid string, err error) {
|
||
|
|
actor, ok := authctx.ActorFromContext(ctx)
|
||
|
|
if !ok {
|
||
|
|
return "", "", app.For(code.Auth).AuthUnauthorized("missing actor")
|
||
|
|
}
|
||
|
|
return actor.TenantID, actor.UID, nil
|
||
|
|
}
|