Builds the query statement for an access N1QL query.
(username string)
| 447 | |
| 448 | // Builds the query statement for an access N1QL query. |
| 449 | func (c *DatabaseCollection) buildAccessQuery(username string) string { |
| 450 | statement := replaceSyncTokensQuery(QueryAccess.statement, c.UseXattrs()) |
| 451 | |
| 452 | // SG usernames don't allow back tick, but guard username in select clause for additional safety |
| 453 | username = strings.Replace(username, "`", "``", -1) |
| 454 | statement = strings.Replace(statement, QuerySelectUserName, username, -1) |
| 455 | statement = replaceIndexTokensQuery(statement, sgIndexes[IndexAccess], c.UseXattrs(), c.numIndexPartitions()) |
| 456 | return statement |
| 457 | } |
| 458 | |
| 459 | // Query to compute the set of roles granted to the specified user via the Sync Function |
| 460 | func (c *DatabaseCollection) QueryRoleAccess(ctx context.Context, username string) (sgbucket.QueryResultIterator, error) { |