コード例 #1
0
    def get(self):
        app = self.app

        if request.is_xhr:
            return 'brave.core.template.form', dict(
                kind=_("Application"),
                form=manage_form('/application/manage/{0}'.format(app.id)),
                data=dict(name=app.name,
                          description=app.description,
                          site=app.site,
                          contact=app.contact,
                          development=app.development,
                          key=dict(
                              public=app.key.public,
                              private=app.key.private,
                          ),
                          required=app.mask.required,
                          optional=app.mask.optional,
                          groups=app.groups))

        key = SigningKey.from_string(unhexlify(app.key.private),
                                     curve=NIST256p,
                                     hashfunc=sha256)
        return 'brave.core.application.template.view_app', dict(
            app=app,
            key=hexlify(key.get_verifying_key().to_string()),
            pem=key.get_verifying_key().to_pem())
コード例 #2
0
ファイル: manage.py プロジェクト: paxswill/brave-core
    def post(self, **kw):
        if not request.is_xhr:
            raise HTTPNotFound()

        app = self.app
        valid, invalid = manage_form().native(kw)

        for k in ('name', 'description', 'groups', 'site', 'contact'):
            setattr(app, k, valid[k])

        if valid['key']['public'].startswith('-'):
            # Assume PEM format.
            valid['key']['public'] = hexlify(
                VerifyingKey.from_pem(valid['key']['public']).to_string())

        app.key.public = valid['key']['public']
        app.mask.required = valid['required'] or 0
        app.mask.optional = valid['optional'] or 0

        if valid['development'] == "true" or valid['development'] == "True":
            app.development = True
        else:
            app.development = False

        app.save()

        return 'json:', dict(success=True, )
コード例 #3
0
    def post(self, **kw):
        if not request.is_xhr:
            raise HTTPNotFound()

        u = user._current_obj()
        valid, invalid = manage_form().native(kw)

        app = Application(owner=u,
                          **{
                              k: v
                              for k, v in valid.iteritems()
                              if k in ('name', 'description', 'groups', 'site',
                                       'contact')
                          })

        app.key.public = valid['key']['public']
        app.mask.required = valid['required'] or 0
        app.mask.optional = valid['optional'] or 0

        if valid['development'] == "true" or valid['development'] == "True":
            app.development = True
        else:
            app.development = False

        app.save()

        return 'json:', dict(success=True, location='/application/manage/')
コード例 #4
0
ファイル: manage.py プロジェクト: Acen/core
 def get(self):
     app = self.app
     
     if request.is_xhr:
         return 'brave.core.template.form', dict(
                 kind = _("Application"),
                 form = manage_form('/application/manage/{0}'.format(app.id)),
                 data = dict(
                         name = app.name,
                         description = app.description,
                         site = app.site,
                         contact = app.contact,
                         development = app.development,
                         key = dict(
                                 public = app.key.public,
                                 private = app.key.private,
                             ),
                         required = app.mask.required,
                         optional = app.mask.optional,
                         groups = app.groups
                     )
             )
     
     key = SigningKey.from_string(unhexlify(app.key.private), curve=NIST256p, hashfunc=sha256)
     return 'brave.core.application.template.view_app', dict(
             app = app,
             key = hexlify(key.get_verifying_key().to_string()),
             pem = key.get_verifying_key().to_pem()
         )
コード例 #5
0
ファイル: manage.py プロジェクト: paxswill/brave-core
 def post(self, **kw):
     if not request.is_xhr:
         raise HTTPNotFound()
     
     app = self.app
     valid, invalid = manage_form().native(kw)
     
     for k in ('name', 'description', 'groups', 'site', 'contact'):
         setattr(app, k, valid[k])
     
     if valid['key']['public'].startswith('-'):
         # Assume PEM format.
         valid['key']['public'] = hexlify(VerifyingKey.from_pem(valid['key']['public']).to_string())
     
     app.key.public = valid['key']['public']
     app.mask.required = valid['required'] or 0
     app.mask.optional = valid['optional'] or 0
     
     if valid['development'] == "true" or valid['development'] == "True":
         app.development = True
     else:
         app.development = False
     
     app.save()
     
     return 'json:', dict(
             success = True,
         )
コード例 #6
0
ファイル: manage.py プロジェクト: Acen/core
 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
         )
コード例 #7
0
    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)
コード例 #8
0
ファイル: manage.py プロジェクト: Acen/core
 def post(self, **kw):
     if not request.is_xhr:
         raise HTTPNotFound()
     
     u = user._current_obj()
     valid, invalid = manage_form().native(kw)
     
     app = Application(owner=u, **{k: v for k, v in valid.iteritems() if k in ('name', 'description', 'groups', 'site', 'contact')})
     
     app.key.public = valid['key']['public']
     app.mask.required = valid['required'] or 0
     app.mask.optional = valid['optional'] or 0
     
     if valid['development'] == "true" or valid['development'] == "True":
         app.development = True
     else:
         app.development = False
     
     app.save()
     
     return 'json:', dict(
             success = True,
             location = '/application/manage/'
         )