Exemplo n.º 1
0
def remove_member():
    result = {"error": None, "data": {}}

    parser = RequestParser()
    parser.argument("account", type=helpers.account, required=True)
    parser.argument("slug", type=helpers.team, required=True)
    args = parser.parse()

    account = args["account"]
    team = args["slug"]

    TeamService.remove_member(team, account)
    PermissionService.remove(account, "global", "publishing")

    result["data"] = team.dict(True)
    return result
Exemplo n.º 2
0
    def post(self):
        result = {"error": None, "data": {}}

        parser = reqparse.RequestParser()
        parser.add_argument("username", type=str, required=True)
        parser.add_argument("admin", type=bool, default=False)
        parser.add_argument("slug", type=str, required=True)
        args = parser.parse_args()

        team = TeamService.get_by_slug(args["slug"])
        if team is None:
            return abort("team", "not-found")

        account = UserService.get_by_username(args["username"])
        if account is None:
            return abort("account", "not-found")

        TeamService.remove_member(team, account)
        PermissionService.remove(account, "global", "publishing")

        result["data"] = team.dict(True)
        return result