- if ":" in final_content.keys():
- final_content["root"] = final_content[":"]
- del final_content[":"]
-
- if "root" not in final_content.keys():
- final_content["root"] = False
-
- @staticmethod
- def format_on_show(content):
- """
- Modifies the content of the role information to separate the role
- metadata from the role definition. Eases the reading process of the
- role definition.
-
- :param definition: role definition to be processed
- """
- content["_id"] = str(content["_id"])
-
- def show(self, session, _id):
- """
- Get complete information on an topic
-
- :param session: contains "username", "admin", "force", "public", "project_id", "set_project"
- :param _id: server internal id
- :return: dictionary, raise exception if not found.
- """
- filter_db = {"_id": _id}
-
- role = self.db.get_one(self.topic, filter_db)
- new_role = dict(role)
- self.format_on_show(new_role)
-
- return new_role
-
- def list(self, session, filter_q=None):
- """
- Get a list of the topic that matches a filter
-
- :param session: contains "username", "admin", "force", "public", "project_id", "set_project"
- :param filter_q: filter of data to be applied
- :return: The list, it can be empty if no one match the filter.
- """
- if not filter_q:
- filter_q = {}