-
- projects = self.db.get_one("projects", fail_on_empty=False, fail_on_more=False)
- if projects:
- return None
- project_desc = {"name": "admin"}
- fake_session = {"project_id": "admin", "username": "admin", "admin": True, "force": True, "public": None}
- rollback_list = []
- _id = self.map_topic["projects"].new(rollback_list, fake_session, project_desc)
- return _id
-
- def create_admin_user(self):
- """
- Creates a new user admin/admin into database if database is empty. Useful for initialization
- :return: _id identity of the inserted data, or None
- """
- users = self.db.get_one("users", fail_on_empty=False, fail_on_more=False)
- if users:
- return None
- # raise EngineException("Unauthorized. Database users is not empty", HTTPStatus.UNAUTHORIZED)
- user_desc = {"username": "admin", "password": "admin", "projects": ["admin"]}
- fake_session = {"project_id": "admin", "username": "admin", "admin": True, "force": True, "public": None}
- roolback_list = []
- _id = self.map_topic["users"].new(roolback_list, fake_session, user_desc)
- return _id
-
- def create_admin(self):
- """
- Creates new 'admin' user and project into database if database is empty. Useful for initialization.
- :return: _id identity of the inserted data, or None
+ Cancels an item
+ :param rollback: list to append created items at database in case a rollback must to be done
+ :param session: contains the used login username and working project, force to avoid checkins, public
+ :param topic: it can be: users, projects, vim_accounts, sdns, nsrs, nsds, vnfds
+ :param indata: data to be inserted
+ :param kwargs: used to override the indata descriptor
+ :param headers: http request headers
+ :return: _id: identity of the inserted data.