MCPcopy Create free account
hub / github.com/AstroPrint/AstroBox / _save

Method _save

src/astroprint/users.py:122–143  ·  view source on GitHub ↗
(self, force=False)

Source from the content-addressed store, hash-verified

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():

Callers 11

addUserMethod · 0.95
changeUserActivationMethod · 0.95
changeCloudAccessKeysMethod · 0.95
changeUserFleetInfoMethod · 0.95
addRolesToUserMethod · 0.95
removeRolesFromUserMethod · 0.95
changeUserPinMethod · 0.95
changeUserPasswordMethod · 0.95
generateApiKeyMethod · 0.95
deleteApikeyMethod · 0.95
removeUserMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected