(self, force=False)
| 120 | s.save() |
| 121 | |
| 122 | def _save(self, force=False): |
| 123 | if not self._dirty and not force: |
| 124 | return |
| 125 | |
| 126 | data = {} |
| 127 | for name in self._users.keys(): |
| 128 | user = self._users[name] |
| 129 | data[name] = { |
| 130 | "password": user._passwordHash, |
| 131 | "pin": user._pinHash, |
| 132 | "active": user._active, |
| 133 | "roles": user._roles, |
| 134 | "apikey": user._apikey, |
| 135 | "publicKey": user.publicKey, |
| 136 | "privateKey": user.privateKey, |
| 137 | "orgId" : user.orgId, |
| 138 | "groupId" : user.groupId |
| 139 | } |
| 140 | |
| 141 | with open(self._userfile, "wb") as f: |
| 142 | yaml.safe_dump(data, f, default_flow_style=False, indent=" ", allow_unicode=True) |
| 143 | self._dirty = False |
| 144 | |
| 145 | def addUser(self, username, password, publicKey, privateKey, orgId, groupId, active=False, roles=["user"], apikey=None): |
| 146 | if username in self._users.keys(): |
no outgoing calls
no test coverage detected