Skip to content

Commit

Permalink
permission routers updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Silence0ne committed Dec 26, 2024
1 parent 506695c commit 90ae691
Showing 1 changed file with 246 additions and 23 deletions.
269 changes: 246 additions & 23 deletions open-api.json
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@
},
"/permission": {
"get": {
"description": "Ruturn the list of all permissions",
"description": "Return the list of all permissions",
"security": [
{
"ApiKeyAuth": []
Expand All @@ -1056,7 +1056,31 @@
"tags": ["permission"],
"responses": {
"200": {
"description": "Returns the list of all permissions"
"description": "Returns the list of all permissions",
"content": {
"application/json": {
"example": [
{
"uuid": "c7a4c02c-fdf7-4f66-90cf-5fd417fc7bcf",
"account": {
"uuid": "3b28d18b-13a9-46d6-b4c9-b3452b7280db",
"username": "admin",
"first_name": "Admin",
"last_name": "User"
},
"object": "resource",
"action": "delete",
"conditions": [
{
"id": 1,
"name": "time_based",
"value": "true"
}
]
}
]
}
}
}
}
},
Expand All @@ -1076,40 +1100,84 @@
"subject": {
"type": "string",
"description": "The user uuid or * for all users",
"example": "f9339c7a-749a-408e-a03e-a22cd87fe3a1"
"example": "f9339c7a-749a-408e-a03e-a22cd87fe3a1",
"nullable": true
},
"object": {
"type": "string",
"description": "The controller that the user need to access",
"example": "Translation, Reciters & etc"
"description": "The controller that the user needs to access",
"example": "Translation, Reciters & etc",
"nullable": false
},
"action": {
"type": "string",
"description": "The action for controller & etc",
"example": "Add, Edit, View, List, Delete & etc"
"example": "Add, Edit, View, List, Delete & etc",
"nullable": false
},
"conditions": {
"items": {},
"type": "array",
"description": "Array of conditions, each condition is an object has name & value, currently only possible condition is isOwner(Boolean)",
"example": "[{ \"name\": \"isOwner\", \"value\":\"true\"]"
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"description": "Unique ID of the condition. Nullable or auto-generated.",
"nullable": true
},
"name": {
"type": "string",
"description": "Condition name (e.g., isOwner)",
"example": "isOwner",
"nullable": false
},
"value": {
"type": "string",
"description": "Condition value (e.g., true)",
"example": "true",
"nullable": false
}
},
"required": ["name", "value"]
},
"description": "Array of conditions, each condition is an object with a name & value. Currently, only the condition 'isOwner' is possible.",
"example": "[{ \"name\": \"isOwner\", \"value\": \"true\" }]"
}
}
},
"required": ["object", "action", "conditions"]
}
}
}
},
"tags": ["permission"],
"responses": {
"200": {
"description": "This means new permission created"
"description": "Permission successfully edited",
"content": {
"application/json": {
"example": {
"message": "Added"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"example": {
"error_name": "INTERNAL_ERROR",
"message": "Internal Error!"
}
}
}
}
}
}
},
"/permission/{permission_uuid}": {
"get": {
"description": "View permission with id you specified",
"description": "View permission with the ID you specified",
"security": [
{
"ApiKeyAuth": []
Expand All @@ -1121,14 +1189,90 @@
"required": true,
"name": "permission_uuid",
"schema": {
"type": "string"
"type": "string",
"description": "The unique UUID of the permission you want to view",
"example": "4454f3fc-acf5-4933-ac14-1ce0b055b523"
}
}
],
"tags": ["permission"],
"responses": {
"200": {
"description": "Returns the permission with id you specified"
"description": "Returns the permission with the ID you specified",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"uuid": {
"type": "string",
"description": "Unique UUID of the permission",
"example": "4454f3fc-acf5-4933-ac14-1ce0b055b523"
},
"account": {
"type": "object",
"properties": {
"uuid": {
"type": "string",
"description": "UUID of the account",
"example": "456lj070-21ac-0d3j-0000-ac0s3n47ed08"
},
"username": {
"type": "string",
"description": "Username of the account",
"example": "curator"
},
"first_name": {
"type": "string",
"description": "First name of the account holder",
"nullable": true,
"example": null
},
"last_name": {
"type": "string",
"description": "Last name of the account holder",
"nullable": true,
"example": null
}
},
"required": ["uuid", "username"]
},
"object": {
"type": "string",
"description": "The object that the permission applies to",
"example": "permission"
},
"action": {
"type": "string",
"description": "The action allowed on the object",
"example": "create"
},
"conditions": {
"type": "array",
"description": "Array of conditions associated with the permission",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Condition name",
"example": "isOwner"
},
"value": {
"type": "string",
"description": "Condition value",
"example": "true"
}
},
"required": ["name", "value"]
},
"example": []
}
},
"required": ["uuid", "account", "object", "action"]
}
}
}
}
}
},
Expand All @@ -1145,7 +1289,8 @@
"required": true,
"name": "permission_uuid",
"schema": {
"type": "string"
"type": "string",
"format": "uuid"
}
}
],
Expand All @@ -1154,27 +1299,47 @@
"application/json": {
"schema": {
"type": "object",
"required": ["subject", "object", "action"],
"properties": {
"subject": {
"type": "string",
"format": "uuid",
"description": "The user uuid or * for all users",
"example": "f9339c7a-749a-408e-a03e-a22cd87fe3a1"
},
"object": {
"type": "string",
"description": "The controller that the user need to access",
"example": "Translation, Reciters & etc"
"example": "Translation"
},
"action": {
"type": "string",
"description": "The action for controller & etc",
"example": "Add, Edit, View, List, Delete & etc"
"description": "The action for controller",
"example": "Edit"
},
"conditions": {
"items": {},
"type": "array",
"description": "Array of conditions, each condition is an object includ has name & value, currently only possible condition is isOwner(Boolean)",
"example": "[{ \"name\": \"isOwner\", \"value\":\"true\"]"
"description": "Array of conditions",
"items": {
"type": "object",
"required": ["name", "value"],
"properties": {
"name": {
"type": "string",
"description": "Name of the condition"
},
"value": {
"type": "string",
"description": "Value of the condition"
}
}
},
"example": [
{
"name": "isOwner",
"value": "true"
}
]
}
}
}
Expand All @@ -1184,7 +1349,36 @@
"tags": ["permission"],
"responses": {
"200": {
"description": "Permission with id you specified edited"
"description": "Permission successfully edited",
"content": {
"application/json": {
"example": {
"message": "Edited"
}
}
}
},
"404": {
"description": "The permission with the given UUID was not found",
"content": {
"application/json": {
"example": {
"error_name": "NOT_FOUND",
"message": "Not found"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"example": {
"error_name": "INTERNAL_ERROR",
"message": "Internal Error!"
}
}
}
}
}
},
Expand All @@ -1208,7 +1402,36 @@
"tags": ["permission"],
"responses": {
"200": {
"description": "Permission with id you specified deleted"
"description": "permission with id you specified deleted",
"content": {
"application/json": {
"example": {
"message": "Deleted"
}
}
}
},
"404": {
"description": "The permission with the given UUID was not found.",
"content": {
"application/json": {
"example": {
"error_name": "NOT_FOUND",
"message": "Not found"
}
}
}
},
"500": {
"description": "Internal server error.",
"content": {
"application/json": {
"example": {
"error_name": "INTERNAL_ERROR",
"message": "Internal Error!"
}
}
}
}
}
}
Expand Down

0 comments on commit 90ae691

Please sign in to comment.