コード例 #1
0
 def create(cls, data, role):
     collection = cls()
     collection.update(data)
     collection.foreign_id = make_token()
     collection.creator = role
     db.session.add(collection)
     db.session.flush()
     if role is not None:
         Permission.grant_resource(Permission.COLLECTION, collection.id,
                                   role, True, True)
     return collection