def verifyTeamId(**kwargs): if 'team_id' not in kwargs: tangelo.http_status(500) tangelo.log("team_id required.") return "team id required for this call." user = get_user() # verify the user can access the team if not datawake_mysql.hasTeamAccess(user.get_email(),kwargs['team_id']): tangelo.content_type() tangelo.http_status(401) tangelo.log("401 Unauthorized. User has no access to requested team.") return "401 Unauthorized" return callback(**kwargs)
def verifyTeamId(**kwargs): if 'team_id' not in kwargs: tangelo.http_status(500) tangelo.log("team_id required.") return "team id required for this call." user = get_user() # verify the user can access the team if not datawake_mysql.hasTeamAccess(user.get_email(), kwargs['team_id']): tangelo.content_type() tangelo.http_status(401) tangelo.log( "401 Unauthorized. User has no access to requested team.") return "401 Unauthorized" return callback(**kwargs)
def get(team_id): """ Verify the logged in user has access to the requested team and return that teams list of domains. :param team_id: :return: List of domain objects for the team [{'id':domain_id,'name','name':domainname,'description':domaindescription},..] """ user = helper.get_user() if not db.hasTeamAccess(user.get_email(),team_id): tangelo.content_type() tangelo.http_status(401) tangelo.log("401 Unauthorized domains/?team_id="+str(team_id)+" user: "******"401 Unauthorized" else: results = db.get_domains(team_id) return json.dumps(results)
def get(team_id): """ Verify the logged in user has access to the requested team and return that teams list of domains. :param team_id: :return: List of domain objects for the team [{'id':domain_id,'name','name':domainname,'description':domaindescription},..] """ user = helper.get_user() if not db.hasTeamAccess(user.get_email(), team_id): tangelo.content_type() tangelo.http_status(401) tangelo.log("401 Unauthorized domains/?team_id=" + str(team_id) + " user: "******"401 Unauthorized" else: results = db.get_domains(team_id) return json.dumps(results)