简体   繁体   中英

Arangodb: arangosh get granted databases/users for a given user/database

How to get from within arangosh
1) all granted databases for a given user
2) all granted users for a given database
?

You can do this with AQL.

1) db._query("FOR u IN _users FILTER u.user == @user FOR db IN ATTRIBUTES(u.databases) FILTER u.databases[db] == 'rw' RETURN db", {"user":"user_name"})

2) db._query("FOR u IN _users LET userDbs = (FOR db IN @dbs FILTER u.databases[db] == 'rw' RETURN db) FILTER LENGTH(userDbs) RETURN u.user", {"dbs":["*","database_name","another_database_name"]})

With the second AQL you can search for users that have access to one of the given databases. A user can have access to all databases (like root user) and not to one explicit. In this case you have to use * as database name, like in my example.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM