def generate_key(identifier): from brave.core.application.model import Application key = SigningKey.generate(NIST256p, hashfunc=sha256) Application.objects( id=identifier, key__private=None # Make sure we don't override an existing one. ).update(set__key__private=hexlify(key.to_string()))
def index(self): records = Application.objects(development__in=[False, None]) # TODO: This needs to be ACL-filtered! devRecords = Application.objects(development=True) return 'brave.core.application.template.list_apps', dict( area = 'apps', records = records, devRecords = devRecords )
def generate_key(identifier): from brave.core.application.model import Application key = SigningKey.generate(NIST256p, hashfunc=sha256) Application.objects( id = identifier, key__private = None # Make sure we don't override an existing one. ).update( set__key__private = hexlify(key.to_string()) )
def merge(self, other): """Consumes other and takes its children.""" other.credentials.update(set__owner=self) other.characters.update(set__owner=self) LoginHistory.objects(user=other).update(set__user=self) from brave.core.group.model import Group from brave.core.application.model import Application, ApplicationGrant Group.objects(creator=other).update(set__creator=self) Application.objects(owner=other).update(set__owner=self) ApplicationGrant.objects(user=other).update(set__user=self) other.delete()
def merge(self, other): """Consumes other and takes its children.""" other.credentials.update(set__owner=self) other.characters.update(set__owner=self) LoginHistory.objects(user=other).update(set__user=self) from brave.core.group.model import Group from brave.core.application.model import Application, ApplicationGrant Group.objects(creator=other).update(set__creator=self) Application.objects(owner=other).update(set__owner=self) ApplicationGrant.objects(user=other).update(set__user=self) other.delete()
def get(self): if user.admin: adminRecords = {record for record in Application.objects() if record.owner != user._current_obj()} else: adminRecords = {} records = Application.objects(owner=user._current_obj()) if request.is_xhr: return 'brave.core.template.form', dict( kind = _("Application"), form = manage_form(), data = None, ) return 'brave.core.application.template.manage_apps', dict( area = 'apps', records = records, adminRecords = adminRecords )
def get(self): if user.admin: adminRecords = { record for record in Application.objects() if record.owner != user._current_obj() } else: adminRecords = {} records = Application.objects(owner=user._current_obj()) if request.is_xhr: return 'brave.core.template.form', dict( kind=_("Application"), form=manage_form(), data=None, ) return 'brave.core.application.template.manage_apps', dict( area='apps', records=records, adminRecords=adminRecords)