mirror of https://gitee.com/bigwinds/arangodb
53 lines
897 B
Markdown
53 lines
897 B
Markdown
---
|
|
layout: default
|
|
description: I'm looking for user database grants
|
|
---
|
|
Show grants function
|
|
====================
|
|
|
|
Problem
|
|
-------
|
|
|
|
I'm looking for user database grants
|
|
|
|
|
|
Solution
|
|
--------
|
|
Create a global function in your _.arangosh.rc_ file like this:
|
|
```
|
|
global.show_grants = function () {
|
|
let stmt;
|
|
stmt=db._createStatement({"query": "FOR u in _users RETURN {\"user\": u.user, \"databases\": u.databases}"});
|
|
console.log(stmt.execute().toString());
|
|
};
|
|
```
|
|
Now when you enter in arangosh, you can call **show_grants()** function.
|
|
|
|
#### Function out example
|
|
```
|
|
[object ArangoQueryCursor, count: 3, hasMore: false]
|
|
|
|
|
|
[
|
|
{
|
|
"user" : "foo",
|
|
"databases" : {
|
|
"_system" : "rw",
|
|
"bar" : "rw"
|
|
}
|
|
},
|
|
{
|
|
"user" : "foo2",
|
|
"databases" : {
|
|
"bar" : "rw"
|
|
}
|
|
},
|
|
{
|
|
"user" : "root",
|
|
"databases" : {
|
|
"*" : "rw"
|
|
}
|
|
}
|
|
]
|
|
```
|