You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a new Item is created using the model PUT API it uses the parent new function and not the child. This prevent you from setting default values when a new item is created.
All new's should use kwargs and then model put should us the child new not the parent
This means the new secret objects have to define the token when the ENC value is first defined. It would be better if this could have been part of the new function instead. But the new function as shown does not get called.
def new(self,acl,name,secretValue,comment=""):
self.acl = acl
self.name = name
self.secretValue = secretValue
self.comment = comment
return super(_secret, self).new()
def setAttribute(self,attr,value,sessionData=None):
if attr == "secretValue" and not value.startswith("ENC "):
if jimi.db.fieldACLAccess(sessionData,self.acl,attr,accessType="write"):
if not self.token:
self.token = secrets.token_hex(128)
self.update(["token"])
self.secretValue = "ENC {0}".format(jimi.auth.getENCFromPassword(value))
return True
return False
return super(_secret, self).setAttribute(attr,value,sessionData=sessionData)
The text was updated successfully, but these errors were encountered:
When a new Item is created using the model PUT API it uses the parent new function and not the child. This prevent you from setting default values when a new item is created.
All new's should use kwargs and then model put should us the child new not the parent
model.py
This means the new secret objects have to define the token when the ENC value is first defined. It would be better if this could have been part of the new function instead. But the new function as shown does not get called.
The text was updated successfully, but these errors were encountered: