| | |
| | | sex = Column(String(1)) |
| | | permission = Column(String(16), default="general") |
| | | age = Column(Integer) |
| | | sync_flag = Column(String(36)) |
| | | created_at = Column(DateTime, default=datetime.now()) |
| | | updated_at = Column(DateTime, default=datetime.now(), onupdate=datetime.now()) |
| | | |
| | |
| | | for ogt in self.organizations: |
| | | if ogt.id in ogt_set: |
| | | continue |
| | | print(ogt.id) |
| | | ogt_set.add(ogt.id) |
| | | for role in ogt.roles: |
| | | roles[role.id] = role.to_dict() |
| | |
| | | while parent_ogt: |
| | | if parent_ogt.id not in ogt_set: |
| | | ogt_set.add(ogt.id) |
| | | for role in ogt.roles: |
| | | for role in parent_ogt.roles: |
| | | roles[role.id] = role.to_dict() |
| | | parent_ogt = ogt.parent |
| | | parent_ogt = parent_ogt.parent |
| | | else: |
| | | break |
| | | |
| | | json['roles'] = list(roles.values()) |
| | | return json |
| | | |
| | |
| | | "app_type": self.app_type, |
| | | 'status': self.status, |
| | | } |
| | | |
| | | def encrypted_password(self, password): |
| | | @staticmethod |
| | | def encrypted_password(password): |
| | | return cipher_suite.encrypt(password.encode("utf-8")).decode("utf-8") |
| | | |
| | | def decrypted_password(self): |
| | | return cipher_suite.decrypt(self.password).decode("utf-8") |
| | | @staticmethod |
| | | def decrypted_password(password): |
| | | return cipher_suite.decrypt(password).decode("utf-8") |