def get_group_users(group): try: users = reports.get_group_users(db.session, group) except HTTPRequestError as err: return format_response(err.errorCode, err.message) else: users_safe = list(map(lambda p: p.safe_dict(), users)) return make_response(json.dumps({"users": users_safe}, default=json_serial), 200)
def get_all_user_permissions(user): try: permissions = reports.get_all_user_permissions(db.session, user) except HTTPRequestError as err: return format_response(err.errorCode, err.message) else: permissions_safe = list(map(lambda p: p.safe_dict(), permissions)) return make_response(json.dumps({"permissions": permissions_safe}, default=json_serial), 200)
def getGroupUsers(group): try: users = reports.getGroupUsers(db.session, group) except HTTPRequestError as err: return formatResponse(err.errorCode, err.message) else: usersSafe = list(map(lambda p: p.safeDict(), users)) return make_response(json.dumps({"users": usersSafe}), 200)
def getUserGrups(user): try: groups = reports.getUserGrups(db.session, user) except HTTPRequestError as err: return formatResponse(err.errorCode, err.message) else: groupsSafe = list(map(lambda p: p.safeDict(), groups)) return make_response(json.dumps({"groups": groupsSafe}), 200)
def getAllUserPermissions(user): try: permissions = reports.getAllUserPermissions(db.session, user) except HTTPRequestError as err: return formatResponse(err.errorCode, err.message) else: permissionsSafe = list(map(lambda p: p.safeDict(), permissions)) return make_response(json.dumps({ "permissions": permissionsSafe }), 200)
def get_user_groups(user): try: groups = reports.get_user_groups(db.session, user) except HTTPRequestError as err: publish_alarm(err) return format_response(err.errorCode, err.message) else: groups_safe = list(map(lambda p: p.safe_dict(), groups)) return make_response( json.dumps({"groups": groups_safe}, default=json_serial), 200)