oficina / home Public

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

Plain git — no account needed to clone.

Download

Download this file

1//go:build linux
2
3package home
4
5import (
6 "context"
7 "database/sql"
8 "encoding/json"
9
10 "amadan.net/oficina/home/internal/operator"
11)
12
13func operatorSchemaCheck(role string) (func(context.Context, *sql.Conn) error, error) {
14 set := compatibilitySchema(role)
15 if set == nil {
16 return nil, operator.ErrRefused
17 }
18 raw, err := compatibilityProfiles.ReadFile("compatibility_profiles/" + role + ".json")
19 if err != nil {
20 return nil, operator.ErrUnavailable
21 }
22 var profile []schemaObject
23 if json.Unmarshal(raw, &profile) != nil || len(profile) == 0 {
24 return nil, operator.ErrUnavailable
25 }
26 return func(ctx context.Context, conn *sql.Conn) error {
27 if conn == nil {
28 return operator.ErrRefused
29 }
30 return checkCompatibilitySchema(ctx, conn, set, profile)
31 }, nil
32}
33