grafana-iam: Implement resourcepermission list (#110769)
* 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>
This commit is contained in:
co-authored by
Ieva
mohammad-hamid
parent
7c242eeaef
commit
5c6fd5e5af
@@ -0,0 +1,10 @@
|
||||
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 }}
|
||||
Reference in New Issue
Block a user