-
Notifications
You must be signed in to change notification settings - Fork 0
/
permissions_apply.go
53 lines (48 loc) · 1.69 KB
/
permissions_apply.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
package enthasura
import (
"github.com/minskylab/hasura-api/metadata"
)
func (r *Runtime) pgCreateInsertPermission(perm map[string]interface{}, tableName, roleName, sourceName, schemaName string) metadata.MetadataQuery {
return metadata.PgCreateInsertPermissionQuery(&metadata.PgCreateInsertPermissionArgs{
Permission: metadata.GenericPermission(perm),
Table: metadata.QualifiedTableName{
Name: tableName,
Schema: schemaName,
},
Role: roleName,
Source: sourceName,
})
}
func (r *Runtime) pgCreateSelectPermission(perm map[string]interface{}, tableName, role, sourceName, schemaName string) metadata.MetadataQuery {
return metadata.PgCreateSelectPermissionQuery(&metadata.PgCreateSelectPermissionArgs{
Permission: metadata.GenericPermission(perm),
Table: metadata.QualifiedTableName{
Name: tableName,
Schema: schemaName,
},
Role: role,
Source: sourceName,
})
}
func (r *Runtime) pgCreateUpdatePermission(perm map[string]interface{}, tableName, role, sourceName, schemaName string) metadata.MetadataQuery {
return metadata.PgCreateUpdatePermissionQuery(&metadata.PgCreateUpdatePermissionArgs{
Permission: metadata.GenericPermission(perm),
Table: metadata.QualifiedTableName{
Name: tableName,
Schema: schemaName,
},
Role: role,
Source: sourceName,
})
}
func (r *Runtime) pgCreateDeletePermission(perm map[string]interface{}, tableName, role, sourceName, schemaName string) metadata.MetadataQuery {
return metadata.PgCreateDeletePermissionQuery(&metadata.PgCreateDeletePermissionArgs{
Permission: metadata.GenericPermission(perm),
Table: metadata.QualifiedTableName{
Name: tableName,
Schema: schemaName,
},
Role: role,
Source: sourceName,
})
}