Exemple #1
0
    def get(self, resource_id=None):
        """Fetch group(s)"""

        logging.info('invitations::get', extra=dict(resource_id=resource_id))
        if resource_id is None:
            if self.user.is_admin:
                invites = self.db.get_group_invites()
            else:
                invites = self.db.get_group_invites(self.owner.email)
            self.dump([JsGroupInvitation.from_db(db) for db in invites])
        else:
            invite = self.db.get_group_invite(int(resource_id))
            self.dump(JsGroupInvitation.from_db(invite))
Exemple #2
0
    def get(self, resource_id=None):
        """Fetch group(s)"""

        logging.info('invitations::get', extra=dict(resource_id=resource_id))
        if resource_id is None:
            if self.user.is_admin:
                invites = self.db.get_group_invites()
            else:
                invites = self.db.get_group_invites(self.owner.email)
            self.dump([JsGroupInvitation.from_db(db) for db in invites])
        else:
            invite = self.db.get_group_invite(int(resource_id))
            self.dump(JsGroupInvitation.from_db(invite))
Exemple #3
0
 def get_invitations(self):
     self._verify_owner()
     if self.db.user.is_admin:
         invites = self.db.get_group_invites()
     else:
         invites = self.db.get_group_invites(self.owner.email)
     return [ GroupInvitation.from_db(db) for db in invites ]
Exemple #4
0
 def get_invitations(self):
     self._verify_owner()
     if self.db.user.is_admin:
         invites = self.db.get_group_invites()
     else:
         invites = self.db.get_group_invites(self.owner.email)
     return [GroupInvitation.from_db(db) for db in invites]
Exemple #5
0
    def post(self):
        """Create a new invitation"""
        logging.info('invitations::post', extra=dict(body=self.request.body))
        data = json.loads(self.request.body)

        group = self.db.get_group(data.group_id)
        db = self.db.add_group_invite(group, data.email)
        self.dump(JsGroupInvitation.from_db(db))
Exemple #6
0
    def post(self):
        """Create a new invitation"""
        logging.info('invitations::post', extra=dict(body=self.request.body))
        data = json.loads(self.request.body)

        group = self.db.get_group(data.group_id)
        db = self.db.add_group_invite(group, data.email)
        self.dump(JsGroupInvitation.from_db(db))