dboo::odb::add_group

void add_group (const group_id& group,
                   const std::string& description = "");
add_group ( group )

Creates an new group.

Parameters

group

The name for the new group

description

A description for the group

Return value

(none)

Exceptions

Example

serverdb.cpp

Try it

 1#include <dboo/odb.h>
 2#include <string>
 3
 4string host = "localhost";
 5int port = 8822;
 6string root_pwd = "admin";
 7
 8int main(int argc, char *argv) {
 9  dboo::init();
10  
11  auto db = dboo::odb{host, port, dboo::database_name::server, "root", root_pwd};
12  
13  db.add_group("my-db", "Used for users of database my-db");
14  db.add_group("users", "Other uses");
15  db.add_user("me", "my password", {"users", "my-db"});
16}

serverdb.js

Try it

 1const dboo = require('dboo');
 2
 3
 4const host = "localhost";
 5const port = 8822;
 6const root_pwd = "admin";
 7
 8dboo.init(); // Class declarations must come before init!
 9
10const db = new dboo.odb();
11
12db.connect(host, port, dboo.server_root, "root", root_pwd);
13
14db.add_group("my-db", "Used for users of database my-db");
15db.add_group("users", "Used for normal users");
16db.add_user("me", "my password", ["users", "my-db"]);