code.gitea.io/gitea@v1.22.3/routers/api/v1/org/block.go (about) 1 // Copyright 2024 The Gitea Authors. 2 // SPDX-License-Identifier: MIT 3 4 package org 5 6 import ( 7 "code.gitea.io/gitea/routers/api/v1/shared" 8 "code.gitea.io/gitea/services/context" 9 ) 10 11 func ListBlocks(ctx *context.APIContext) { 12 // swagger:operation GET /orgs/{org}/blocks organization organizationListBlocks 13 // --- 14 // summary: List users blocked by the organization 15 // parameters: 16 // - name: org 17 // in: path 18 // description: name of the organization 19 // type: string 20 // required: true 21 // - name: page 22 // in: query 23 // description: page number of results to return (1-based) 24 // type: integer 25 // - name: limit 26 // in: query 27 // description: page size of results 28 // type: integer 29 // produces: 30 // - application/json 31 // responses: 32 // "200": 33 // "$ref": "#/responses/UserList" 34 35 shared.ListBlocks(ctx, ctx.Org.Organization.AsUser()) 36 } 37 38 func CheckUserBlock(ctx *context.APIContext) { 39 // swagger:operation GET /orgs/{org}/blocks/{username} organization organizationCheckUserBlock 40 // --- 41 // summary: Check if a user is blocked by the organization 42 // parameters: 43 // - name: org 44 // in: path 45 // description: name of the organization 46 // type: string 47 // required: true 48 // - name: username 49 // in: path 50 // description: user to check 51 // type: string 52 // required: true 53 // responses: 54 // "204": 55 // "$ref": "#/responses/empty" 56 // "404": 57 // "$ref": "#/responses/notFound" 58 59 shared.CheckUserBlock(ctx, ctx.Org.Organization.AsUser()) 60 } 61 62 func BlockUser(ctx *context.APIContext) { 63 // swagger:operation PUT /orgs/{org}/blocks/{username} organization organizationBlockUser 64 // --- 65 // summary: Block a user 66 // parameters: 67 // - name: org 68 // in: path 69 // description: name of the organization 70 // type: string 71 // required: true 72 // - name: username 73 // in: path 74 // description: user to block 75 // type: string 76 // required: true 77 // - name: note 78 // in: query 79 // description: optional note for the block 80 // type: string 81 // responses: 82 // "204": 83 // "$ref": "#/responses/empty" 84 // "404": 85 // "$ref": "#/responses/notFound" 86 // "422": 87 // "$ref": "#/responses/validationError" 88 89 shared.BlockUser(ctx, ctx.Org.Organization.AsUser()) 90 } 91 92 func UnblockUser(ctx *context.APIContext) { 93 // swagger:operation DELETE /orgs/{org}/blocks/{username} organization organizationUnblockUser 94 // --- 95 // summary: Unblock a user 96 // parameters: 97 // - name: org 98 // in: path 99 // description: name of the organization 100 // type: string 101 // required: true 102 // - name: username 103 // in: path 104 // description: user to unblock 105 // type: string 106 // required: true 107 // responses: 108 // "204": 109 // "$ref": "#/responses/empty" 110 // "404": 111 // "$ref": "#/responses/notFound" 112 // "422": 113 // "$ref": "#/responses/validationError" 114 115 shared.UnblockUser(ctx, ctx.Doer, ctx.Org.Organization.AsUser()) 116 }