From f4058d92243ecd7c5e6b4d1669f38a81041eaa40 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Mon, 24 Jul 2017 10:57:12 +0500 Subject: Describe Permissions API in swagger --- swagger.json | 355 ++++++++--------------------------------------------------- 1 file changed, 44 insertions(+), 311 deletions(-) (limited to 'swagger.json') diff --git a/swagger.json b/swagger.json index a82232f02..a8d4f5641 100644 --- a/swagger.json +++ b/swagger.json @@ -164,37 +164,6 @@ } } }, - "/devices/geofences": { - "post": { - "summary": "Link a Geofence to a Device", - "parameters": [ - { - "$ref": "#/parameters/DeviceGeofence" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/DeviceGeofence" - } - } - } - }, - "delete": { - "summary": "Remove a Geofence from a Device", - "parameters": [ - { - "$ref": "#/parameters/DeviceGeofence" - } - ], - "responses": { - "204": { - "description": "No Content" - } - } - } - }, "/groups": { "get": { "summary": "Fetch a list of Groups", @@ -273,50 +242,19 @@ } } }, - "/groups/geofences": { - "post": { - "summary": "Link a Geofence to a Group", - "parameters": [ - { - "$ref": "#/parameters/GroupGeofence" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/GroupGeofence" - } - } - } - }, - "delete": { - "summary": "Remove a Geofence from a Group", - "parameters": [ - { - "$ref": "#/parameters/GroupGeofence" - } - ], - "responses": { - "204": { - "description": "No Content" - } - } - } - }, - "/permissions/devices": { + "/permissions": { "post": { - "summary": "Link a Device to a User", + "summary": "Link an Object to another Object", "parameters": [ { - "$ref": "#/parameters/DevicePermission" + "$ref": "#/parameters/Permission" } ], "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/DevicePermission" + "$ref": "#/definitions/Permission" } }, "400": { @@ -325,134 +263,10 @@ } }, "delete": { - "summary": "Remove a Device from a User", - "parameters": [ - { - "$ref": "#/parameters/DevicePermission" - } - ], - "responses": { - "204": { - "description": "No Content" - } - } - } - }, - "/permissions/groups": { - "post": { - "summary": "Link a Group to a User", - "parameters": [ - { - "$ref": "#/parameters/GroupPermission" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/GroupPermission" - } - } - } - }, - "delete": { - "summary": "Remove a Group from a User", - "parameters": [ - { - "$ref": "#/parameters/GroupPermission" - } - ], - "responses": { - "204": { - "description": "No Content" - } - } - } - }, - "/permissions/geofences": { - "post": { - "summary": "Link a Geofence to a User", - "parameters": [ - { - "$ref": "#/parameters/GeofencePermission" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/GeofencePermission" - } - } - } - }, - "delete": { - "summary": "Remove a Geofence from a User", + "summary": "Unlink an Object from another Object", "parameters": [ { - "$ref": "#/parameters/GeofencePermission" - } - ], - "responses": { - "204": { - "description": "No Content" - } - } - } - }, - "/permissions/calendars": { - "post": { - "summary": "Link a Calendar to a User", - "parameters": [ - { - "$ref": "#/parameters/CalendarPermission" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/CalendarPermission" - } - } - } - }, - "delete": { - "summary": "Remove a Calendar from a User", - "parameters": [ - { - "$ref": "#/parameters/CalendarPermission" - } - ], - "responses": { - "204": { - "description": "No Content" - } - } - } - }, - "/permissions/users": { - "post": { - "summary": "Link a User to a manager User", - "parameters": [ - { - "$ref": "#/parameters/UserPermission" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/UserPermission" - } - } - } - }, - "delete": { - "summary": "Remove a User from a manager User", - "parameters": [ - { - "$ref": "#/parameters/UserPermission" + "$ref": "#/parameters/Permission" } ], "responses": { @@ -1473,75 +1287,42 @@ "attributes": {} } }, - "DevicePermission": { - "properties": { - "userId": { - "type": "integer" - }, - "deviceId": { - "type": "integer" - } - } - }, - "GroupPermission": { - "properties": { - "userId": { - "type": "integer" - }, - "groupId": { - "type": "integer" - } - } - }, - "GeofencePermission": { - "properties": { - "userId": { - "type": "integer" - }, - "geofenceId": { - "type": "integer" - } - } - }, - "CalendarPermission": { - "properties": { - "userId": { - "type": "integer" - }, - "calendarId": { - "type": "integer" - } - } - }, - "UserPermission": { - "properties": { - "userId": { - "type": "integer" - }, - "managedUserId": { - "type": "integer" - } - } - }, - "GroupGeofence": { - "properties": { - "groupId": { - "type": "integer" - }, - "geofenceId": { - "type": "integer" - } - } - }, - "DeviceGeofence": { - "properties": { - "deviceId": { - "type": "integer" - }, - "geofenceId": { - "type": "integer" - } - } + "Permission": { + "description": "This is a permission map that contain two object indexes. It is used to link/unlink objects. Order is important. Example: { deviceId:8, geofenceId: 16 }", + "properties": { + "userId": { + "description": "User Id, can be only first parameter", + "type": "integer" + }, + "deviceId": { + "description": "Device Id, can be first parameter or second only in combination with userId", + "type": "integer" + }, + "groupId": { + "description": "Group Id, can be first parameter or second only in combination with userId", + "type": "integer" + }, + "geofenceId": { + "description": "Geofence Id, can be second parameter only", + "type": "integer" + }, + "calendarId": { + "description": "Geofence Id, can be second parameter only and only in combination with userId", + "type": "integer" + }, + "attributeId": { + "description": "Computed Attribute Id, can be second parameter only", + "type": "integer" + }, + "driverId": { + "description": "Driver Id, can be second parameter only", + "type": "integer" + }, + "managedUserId": { + "description": "User Id, can be second parameter only and only in combination with userId", + "type": "integer" + } + } }, "CommandType": { "properties": { @@ -1793,12 +1574,12 @@ "$ref": "#/definitions/Device" } }, - "DeviceGeofence": { + "Permission": { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/DeviceGeofence" + "$ref": "#/definitions/Permission" } }, "Group": { @@ -1809,54 +1590,6 @@ "$ref": "#/definitions/Group" } }, - "GroupGeofence": { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/GroupGeofence" - } - }, - "DevicePermission": { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/DevicePermission" - } - }, - "GroupPermission": { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/GroupPermission" - } - }, - "GeofencePermission": { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/GeofencePermission" - } - }, - "CalendarPermission": { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CalendarPermission" - } - }, - "UserPermission": { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UserPermission" - } - }, "User": { "name": "body", "in": "body", -- cgit v1.2.3