* WIP: List * make toV0ResourcePermissions work with an ordered list of assignments to ensure consistency in the results * Test templates * Split list query in two. I clearly need scopePatterns * Add pagination with offsets * Remove unecessary comment * implement listiterator * add listiterator tests * return the correct resource version * use SkipIntegrationTestInShortMode * No need for the extra check on pagination being correctly set Co-authored-by: Ieva <ieva.vasiljeva@grafana.com> * Spec is out of date * Remove wrong comment * Add a test for the pagination token --------- Co-authored-by: mohammad-hamid <mohammad.hamid@grafana.com> Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
11 lines
474 B
SQL
11 lines
474 B
SQL
SELECT p.scope
|
|
FROM {{ .Ident .PermissionTable }} AS p
|
|
INNER JOIN {{ .Ident .RoleTable }} AS r ON p.role_id = r.id
|
|
WHERE r.name LIKE {{ .Arg .ManagedRolePattern }}
|
|
AND r.org_id = {{ .Arg .Query.OrgID }}
|
|
AND ( {{ range $index, $scopePattern := .Query.ScopePatterns }}{{ if $index }} OR {{ end }} p.scope LIKE {{ $.Arg $scopePattern }}{{ end }} )
|
|
GROUP BY p.scope
|
|
ORDER BY p.scope
|
|
LIMIT {{ .Arg .Query.Pagination.Limit }}
|
|
OFFSET {{ .Arg .Query.Pagination.Continue }}
|