Esempio n. 1
0
 def mqtt_get_state(self):
     """
     Get the user state that will be used in the payload
     
     :return: The user state as a dictionary
     :rtype: dict
     """
     payload = dict()
     payload["uuid"] = self.uuid
     payload["name"] = self.name
     payload["email"] = self.email
     payload["active"] = self.active
     payload["groups"] = [g.name for g in Group.find_all(self.groups)]
     return payload
Esempio n. 2
0
 def to_dict(self):
     """
     Return a dictionary which describes a resource for the web ui
     
     :return: The dictionary with the information needed for the UI
     :rtype: dict
     """
     return {
         "uuid": self.uuid,
         "name": self.name,
         "email": self.email,
         "administrator": self.administrator,
         "active": self.active,
         "ldap": self.ldap,
         "groups": [g.to_dict() for g in Group.find_all(self.groups)],
     }