-
Notifications
You must be signed in to change notification settings - Fork 2
/
supervisor_grant.go
68 lines (60 loc) · 1.32 KB
/
supervisor_grant.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*-
* Copyright (c) 2016, Jörg Pernfuß <joerg.pernfuss@1und1.de>
* All rights reserved
*
* Use of this source code is governed by a 2-clause BSD license
* that can be found in the LICENSE file.
*/
package stmt
const GrantGlobalOrSystemToUser = `
INSERT INTO soma.authorizations_global (
grant_id,
user_id,
permission_id,
permission_type,
created_by
)
VALUES (
$1::uuid,
$2::uuid,
$3::uuid,
$4::varchar,
$5::uuid
);`
const RevokeGlobalOrSystemFromUser = `
DELETE FROM soma.authorizations_global
WHERE grant_id = $1::uuid;`
const LoadGlobalOrSystemUserGrants = `
SELECT grant_id,
user_id,
permission_id
FROM soma.authorizations_global;`
const GrantLimitedRepoToUser = `
INSERT INTO soma.authorizations_repository (
grant_id,
user_id,
repository_id,
permission_id,
permission_type,
created_by
)
VALUES (
$1::uuid,
$2::uuid,
$3::uuid,
$4::uuid,
$5::varchar,
$6::uuid
);`
const RevokeLimitedRepoFromUser = `
DELETE FROM soma.authorizations_repository
WHERE grant_id = $1::uuid;`
const SearchGlobalSystemGrant = `
SELECT grant_id
FROM soma.authorizations_global
WHERE permission_id = $1::uuid
AND permission_type = $2::varchar
AND ( admin_id = $3::uuid
OR user_id = $3::uuid
OR tool_id = $3::uuid);`
// vim: ts=4 sw=4 sts=4 noet fenc=utf-8 ffs=unix