Struct rincon_session::ArangoSession
[−]
[src]
pub struct ArangoSession<C> { /* fields omitted */ }
A session for administrating databases and users.
An ArangoSession
defines the entry point to the session api. It basically
determines which Connector
implementation shall be used in an application
and provides functions for administrating databases and users.
Methods
impl<C> ArangoSession<C> where
C: 'static + Connector,
[src]
C: 'static + Connector,
pub fn new(connector: C, core: Core) -> Self
[src]
Instantiates a new ArangoSession
using the given Connector
.
pub fn execute<M>(&self, method: M) -> Result<<M as Method>::Result> where
M: 'static + Method + Prepare,
[src]
M: 'static + Method + Prepare,
Executes an API method applied to the system database.
pub fn get_server_version(&self) -> Result<ServerVersion>
[src]
Gets the server name and version number.
pub fn get_server_version_details(&self) -> Result<ServerVersion>
[src]
Gets the server name and version number with additional details.
pub fn get_target_version(&self) -> Result<TargetVersion>
[src]
Gets the database version a server requires.
pub fn use_system_database(&self) -> DatabaseSession<C>
[src]
Returns a new DatabaseSession
for the system database.
In ArangoDB the system database usually has the name _system
.
pub fn use_database_with_name<N>(&self, database_name: N) -> DatabaseSession<C> where
N: Into<String>,
[src]
N: Into<String>,
Returns a new DatabaseSession
for the given database name.
pub fn create_database<N, E>(
&self,
name: N,
users: Vec<NewUser<E>>
) -> Result<DatabaseSession<C>> where
N: Into<String>,
E: 'static + UserExtra + Serialize,
[src]
&self,
name: N,
users: Vec<NewUser<E>>
) -> Result<DatabaseSession<C>> where
N: Into<String>,
E: 'static + UserExtra + Serialize,
Creates a new database with the given attributes.
If the database could be created successfully a DatabaseSession
using
the just created database is returned.
The user provided with the Connector
must have permission to access
the system database in order to execute this method.
Arguments
name
: the name of the database to be createdusers
: a list of users to be assigned to the new database
pub fn drop_database<N>(&self, name: N) -> Result<bool> where
N: Into<String>,
[src]
N: Into<String>,
Drops an existing database with the given name.
Returns true if the database has been dropped successfully.
pub fn list_databases(&self) -> Result<Vec<String>>
[src]
Retrieves a list of all existing databases.
The user set in the Connector
must have permission to read from the
system database in order to execute this method.
pub fn list_accessible_databases(&self) -> Result<Vec<String>>
[src]
Retrieves a list of all databases the current user has access to.
pub fn create_user<N, P, E>(&self, username: N, password: P) -> Result<User<E>> where
N: Into<String>,
P: Into<String>,
E: 'static + UserExtra + Serialize + DeserializeOwned,
[src]
N: Into<String>,
P: Into<String>,
E: 'static + UserExtra + Serialize + DeserializeOwned,
Creates a new user with default options.
The created user will not have access to any database until database access privileges are explicitly granted to it.
The user set in the Connector
must have permission to write to the
system database in order to execute this method.
pub fn create_user_with_details<E>(&self, user: NewUser<E>) -> Result<User<E>> where
E: 'static + UserExtra + Serialize + DeserializeOwned,
[src]
E: 'static + UserExtra + Serialize + DeserializeOwned,
Creates a new user with extra information.
The created user will not have access to any database until database access privileges are explicitly granted to it.
The user set in the Connector
must have permission to write to the
system database in order to execute this method.
pub fn delete_user<N>(&self, username: N) -> Result<Empty> where
N: Into<String>,
[src]
N: Into<String>,
Deletes an existing user with the given name.
The user set in the Connector
must have permission to write to the
system database in order to execute this method.
pub fn get_user<N, E>(&self, username: N) -> Result<User<E>> where
N: Into<String>,
E: 'static + UserExtra + Serialize + DeserializeOwned,
[src]
N: Into<String>,
E: 'static + UserExtra + Serialize + DeserializeOwned,
Fetches data about a user with the given name.
This method can fetch data about the user set in the Connector
. To
retrieve data about any user the user set in the Connector
must have
permission to read from the system database.
pub fn list_users<E>(&self) -> Result<Vec<User<E>>> where
E: 'static + UserExtra + Serialize + DeserializeOwned,
[src]
E: 'static + UserExtra + Serialize + DeserializeOwned,
Fetches data about all available users.
The user set in the Connector
must have permission to read from the
system database in order to execute this method.
pub fn modify_user<N, E>(
&self,
username: N,
updates: UserUpdate<E>
) -> Result<User<E>> where
N: Into<String>,
E: 'static + UserExtra + Serialize + DeserializeOwned,
[src]
&self,
username: N,
updates: UserUpdate<E>
) -> Result<User<E>> where
N: Into<String>,
E: 'static + UserExtra + Serialize + DeserializeOwned,
Partially updates the data of an existing user.
The password can only be changed for the user set in the Connector
.
To change the active status the user set in the Connector
must have
permission to write to the system database.
Arguments
username
: the name of the user for which the data shall be replacedupdates
: the data to be updated for the given user
pub fn replace_user<N, E>(
&self,
username: N,
updates: UserUpdate<E>
) -> Result<User<E>> where
N: Into<String>,
E: 'static + UserExtra + Serialize + DeserializeOwned,
[src]
&self,
username: N,
updates: UserUpdate<E>
) -> Result<User<E>> where
N: Into<String>,
E: 'static + UserExtra + Serialize + DeserializeOwned,
Replaces the data of an existing user.
The password can only be changed for the user set in the Connector
.
To change the active status the user set in the Connector
must have
permission to write to the system database.
Arguments
username
: the name of the user for which the data shall be replacedupdates
: the new data of the user
pub fn list_databases_for_user<N>(
&self,
username: N
) -> Result<HashMap<String, Permission>> where
N: Into<String>,
[src]
&self,
username: N
) -> Result<HashMap<String, Permission>> where
N: Into<String>,
Lists all databases accessible by the given user.
The user set in the Connector
must have permission to read from the
system database in order to execute this method.
pub fn grant_default_database_access<N>(
&self,
username: N,
permission: Permission
) -> Result<Empty> where
N: Into<String>,
[src]
&self,
username: N,
permission: Permission
) -> Result<Empty> where
N: Into<String>,
Sets the default access level for databases for the given user.
The user set in the Connector
must have permission to write to the
system database in order to execute this method.
Arguments
username
: the name of the user for which to grant default accesspermission
: the access level to grant
pub fn grant_default_collection_access<N>(
&self,
username: N,
permission: Permission
) -> Result<Empty> where
N: Into<String>,
[src]
&self,
username: N,
permission: Permission
) -> Result<Empty> where
N: Into<String>,
Sets the default access level for collections for the given user.
The user set in the Connector
must have permission to write to the
system database in order to execute this method.
Arguments
username
: the name of the user for which to grant default accesspermission
: the access level to grant
pub fn get_database_access_level<N, Db>(
&self,
username: N,
database: Db
) -> Result<Permission> where
N: Into<String>,
Db: Into<String>,
[src]
&self,
username: N,
database: Db
) -> Result<Permission> where
N: Into<String>,
Db: Into<String>,
Gets the effective access level to the specified database for the given user.
The user set in the Connector
must have permission to read from the
system database in order to execute this method.
Arguments
username
: the name of the user for which the permissions are querieddatabase
: the name of the database for which the permissions are queried
pub fn grant_database_access<N, Db>(
&self,
username: N,
database: Db,
permission: Permission
) -> Result<Empty> where
N: Into<String>,
Db: Into<String>,
[src]
&self,
username: N,
database: Db,
permission: Permission
) -> Result<Empty> where
N: Into<String>,
Db: Into<String>,
Grants access to the specified database for the given user.
The user set in the Connector
must have permission to write to the
system database in order to execute this method.
Arguments
username
: the name of the user for which access shall be granteddatabase
: the name of the database to which access shall be grantedpermission
: the access level that shall be granted
pub fn revoke_database_access<N, Db>(
&self,
username: N,
database: Db
) -> Result<Empty> where
N: Into<String>,
Db: Into<String>,
[src]
&self,
username: N,
database: Db
) -> Result<Empty> where
N: Into<String>,
Db: Into<String>,
Revokes the access to the specified database for the given user.
After this call the given user has no access to the specified database.
The user set in the Connector
must have permission to write to the
system database in order to execute this method.
Arguments
username
: the name of the user for which access shall be revokeddatabase
: the name of the database from which access shall be revoked
pub fn reset_database_access<N, Db>(
&self,
username: N,
database: Db
) -> Result<Empty> where
N: Into<String>,
Db: Into<String>,
[src]
&self,
username: N,
database: Db
) -> Result<Empty> where
N: Into<String>,
Db: Into<String>,
Resets the access to the specified database for the given user to the default access level.
After this call the default access level to the database is applied for the given user.
The user set in the Connector
must have permission to write to the
system database in order to execute this method.
Arguments
username
: the name of the user for which access shall be reset to the defaultdatabase
: the name of the database for which access shall be reset to the default
pub fn get_collection_access_level<N, Db, Coll>(
&self,
username: N,
database: Db,
collection: Coll
) -> Result<Permission> where
N: Into<String>,
Db: Into<String>,
Coll: Into<String>,
[src]
&self,
username: N,
database: Db,
collection: Coll
) -> Result<Permission> where
N: Into<String>,
Db: Into<String>,
Coll: Into<String>,
Gets the effective access level to the specified collection for the given user.
The user set in the Connector
must have permission to read from the
system database in order to execute this method.
Arguments
username
: the name of the user for which the permissions are querieddatabase
: the name of the database where the collection is located incollection
: the name of the collection for which the permissions are queried
pub fn grant_collection_access<N, Db, Coll>(
&self,
username: N,
database: Db,
collection: Coll,
permission: Permission
) -> Result<Empty> where
N: Into<String>,
Db: Into<String>,
Coll: Into<String>,
[src]
&self,
username: N,
database: Db,
collection: Coll,
permission: Permission
) -> Result<Empty> where
N: Into<String>,
Db: Into<String>,
Coll: Into<String>,
Grants access to the specified collection for the given user.
The user set in the Connector
must have permission to write to the
system database in order to execute this method.
Arguments
username
: the name of the user for which access shall be granteddatabase
: the name of the database where the collection is locatedcollection
: the name of the collection to which access shall be grantedpermission
: the access level that shall be granted
pub fn revoke_collection_access<N, Db, Coll>(
&self,
username: N,
database: Db,
collection: Coll
) -> Result<Empty> where
N: Into<String>,
Db: Into<String>,
Coll: Into<String>,
[src]
&self,
username: N,
database: Db,
collection: Coll
) -> Result<Empty> where
N: Into<String>,
Db: Into<String>,
Coll: Into<String>,
Revokes the access to the specified collection for the given user.
After this call the given user has no access to the specified collection.
The user set in the Connector
must have permission to write to the
system database in order to execute this method.
Arguments
username
: the name of the user for which access shall be revokeddatabase
: the name of the database where the collection is locatedcollection
: the name of the collection from which access shall be revoked
pub fn reset_collection_access<N, Db, Coll>(
&self,
username: N,
database: Db,
collection: Coll
) -> Result<Empty> where
N: Into<String>,
Db: Into<String>,
Coll: Into<String>,
[src]
&self,
username: N,
database: Db,
collection: Coll
) -> Result<Empty> where
N: Into<String>,
Db: Into<String>,
Coll: Into<String>,
Resets the access to the specified collection for the given user to the default access level.
After this call the default access level to the collection is applied for the given user.
The user set in the Connector
must have permission to write to the
system database in order to execute this method.
Arguments
username
: the name of the user for which access shall be reset to the defaultdatabase
: the name of the database where the collection is locatedcollection
: the name of the collection for which access shall be reset to the default