Skip to content

Commit

Permalink
#255 endpoints now carry a dedicated permission
Browse files Browse the repository at this point in the history
  • Loading branch information
itayw committed May 10, 2014
1 parent e5336e8 commit d193136
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 33 deletions.
16 changes: 12 additions & 4 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ workspaces:
- "workspaces:add"
- "workspaces:patch"
- "workspaces:delete"
- "collections:list"
filter: []
users:
root:
Expand Down Expand Up @@ -267,21 +268,23 @@ workspaces:
key: "root"
permissions:
- "access_system"
- "manage_system"
- "manage_users"
- "beacon_insert"
- "query_fetch"
- "workspaces:list"
- "workspaces:get"
- "workspaces:add"
- "workspaces:patch"
- "workspaces:delete"
- "config:get"
- "config:set"
- "permissions:list"
- "permissions:get"
- "collections:list"
- "collections:get"
- "collections:add"
- "collections:patch"
- "collections:delete"
- "collections:metadata"
- "collections:mindate"
- "collections:maxdate"
- "dimensions:list"
- "dimensions:add"
- "dimensions:get"
Expand All @@ -306,6 +309,11 @@ workspaces:
- "users:validateToken"
- "users:expireToken"
- "users:permissions"
- "system:nodeuid"
- "system:nodedetails"
- "system:terminate"
- "system:purgeCache"
- "system:roundtrip"
- "misc:see_private"
filter: []
user:
Expand Down
16 changes: 8 additions & 8 deletions lib/dispatch/collections.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ exports.list = {
inputs: ['workspace'],
_proto: Proto.proto,
_outputExample: {},
_permission: ['manage_system'],
_permission: ['collections:list'],
_dispatch: {
message: 'collections:list'
},
Expand Down Expand Up @@ -109,7 +109,7 @@ exports.get = {
inputs: ['workspace', 'id'],
_proto: Proto.proto,
_outputExample: {},
_permission: ['manage_system'],
_permission: ['collections:get'],
_dispatch: {
message: 'collections:get'
},
Expand Down Expand Up @@ -196,7 +196,7 @@ exports.add = {
description: "I add a new collection",
inputs: ['workspace', 'collection'],
_outputExample: {},
_permission: ['manage_system'],
_permission: ['collections:add'],
_dispatch: {
message: 'collections:add'
},
Expand Down Expand Up @@ -332,7 +332,7 @@ exports.delete = {
description: "I delete an existing collection",
inputs: ['workspace', 'id'],
_outputExample: {},
_permission: ['manage_system'],
_permission: ['collections:delete'],
_dispatch: {
message: 'collections:delete'
},
Expand Down Expand Up @@ -388,7 +388,7 @@ exports.stats = {
description: "I provide stats about a collection",
inputs: ['workspace', 'id'],
_outputExample: {},
_permission: ['manage_system', 'collections_stats'],
_permission: ['collections:stats'],
_dispatch: {
message: 'collections:stats'
},
Expand Down Expand Up @@ -441,7 +441,7 @@ exports.maxdate = {
optional: ['key']
},
_outputExample: {},
_permission: ['manage_system'],
_permission: ['collections:maxdate'],
_dispatch: {
message: 'collections:maxdate'
},
Expand Down Expand Up @@ -499,7 +499,7 @@ exports.mindate = {
optional: ['key']
},
_outputExample: {},
_permission: ['manage_system'],
_permission: ['collections:mindate'],
_dispatch: {
message: 'collections:mindate'
},
Expand Down Expand Up @@ -536,7 +536,7 @@ exports.metadata = {
optional: ['collection']
},
_outputExample: {},
_permission: ['access_system'],
_permission: ['collections:metadata'],
_dispatch: {
message: 'collections:metadata'
},
Expand Down
4 changes: 2 additions & 2 deletions lib/dispatch/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ exports.get = {
description: "I get a specific config by name`",
inputs: ['key'],
_outputExample: {},
_permission: ['manage_system'],
_permission: ['config:get'],
_dispatch: {
message: 'config:get'
},
Expand Down Expand Up @@ -63,7 +63,7 @@ exports.set = {
description: "I set a new config key",
inputs: ['key', 'val'],
_outputExample: {},
_permission: ['manage_system'],
_permission: ['config:set'],
_dispatch: {
message: 'config:set'
},
Expand Down
4 changes: 2 additions & 2 deletions lib/dispatch/permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ exports.list = {
description: "I list all available permissions",
inputs: [],
_outputExample: {},
_permission: ['manage_system'],
_permission: ['permissions:list'],
_dispatch: {
message: 'permissions:list'
},
Expand Down Expand Up @@ -87,7 +87,7 @@ exports.get = {
description: "I get a specific permission by name`",
inputs: ['name'],
_outputExample: {},
_permission: ['manage_system'],
_permission: ['permissions:get'],
_dispatch: {
message: 'permissions:get'
},
Expand Down
10 changes: 5 additions & 5 deletions lib/dispatch/roles.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ exports.list = {
inputs: ['workspace'],
_proto: Proto.proto,
_outputExample: {},
_permission: ['manage_system'],
_permission: ['roles:list'],
_dispatch: {
message: 'roles:list'
},
Expand Down Expand Up @@ -109,7 +109,7 @@ exports.get = {
inputs: ['workspace', 'name'],
_proto: Proto.proto,
_outputExample: {},
_permission: ['manage_system'],
_permission: ['roles:get'],
_dispatch: {
message: 'roles:get'
},
Expand Down Expand Up @@ -175,7 +175,7 @@ exports.add = {
inputs: ['workspace', 'role'],
_proto: Proto.proto,
_outputExample: {},
_permission: ['manage_system'],
_permission: ['roles:add'],
_dispatch: {
message: 'roles:add'
},
Expand Down Expand Up @@ -216,7 +216,7 @@ exports.patch = {
description: "I patch an existing role",
inputs: ['workspace', 'role', 'payload'],
_outputExample: {},
_permission: ['manage_system'],
_permission: ['roles:patch'],
_dispatch: {
message: 'roles:patch'
},
Expand Down Expand Up @@ -284,7 +284,7 @@ exports.delete = {
description: "I delete an existing role",
inputs: ['workspace', 'role'],
_outputExample: {},
_permission: ['manage_system'],
_permission: ['roles:delete'],
_dispatch: {
message: 'roles:delete'
},
Expand Down
16 changes: 8 additions & 8 deletions lib/dispatch/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ exports.blacklist = {
optional: ['ttl']
},
_outputExample: {},
_permission: ['manage_system'],
_permission: ['system:blacklist'],
_dispatch: {
message: 'system:blacklist'
},
Expand Down Expand Up @@ -127,7 +127,7 @@ exports.nodeDetails = {
optional: ['uid']
},
_outputExample: {},
_permission: ['manage_system'],
_permission: ['system:nodedetails'],
_dispatch: {
message: 'system:nodedetails'
},
Expand All @@ -154,7 +154,7 @@ exports.connectedClients = {
optional: ['uid']
},
_outputExample: {},
_permission: ['manage_system'],
_permission: ['system:connectedclients'],
_dispatch: {
message: 'system:connectedclients'
},
Expand Down Expand Up @@ -188,7 +188,7 @@ exports.nodeList = {
description: "I list all registered nodes",
inputs: [],
_outputExample: {},
_permission: ['manage_system'],
_permission: ['system:nodelist'],
_dispatch: {
message: 'system:nodelist'
},
Expand Down Expand Up @@ -221,7 +221,7 @@ exports.roundTrip = {
description: "I execute a roundtrip of a payload and return the time in ms",
inputs: ['start'],
_outputExample: {},
_permission: ['manage_system'],
_permission: ['system:roundtrip'],
_dispatch: {
message: 'roundtrip'
},
Expand All @@ -243,7 +243,7 @@ exports.terminate = {
optional: ['uid']
},
_outputExample: {},
_permission: ['manage_system'],
_permission: ['system:terminate'],
_dispatch: {
message: 'terminate',
limit: -1
Expand Down Expand Up @@ -275,7 +275,7 @@ exports.startWebServer = {
description: "I start a WebServer on a node",
inputs: ['node'],
_outputExample: {},
_permission: ['manage_system'],
_permission: ['system:startWebServer'],
_dispatch: {
message: 'startWebServer'
},
Expand Down Expand Up @@ -309,7 +309,7 @@ exports.purgeCache = {
optional: []
},
_outputExample: {},
_permission: ['manage_system'],
_permission: ['system:purgeCache'],
_dispatch: {
message: 'purgeCache',
limit: -1
Expand Down
8 changes: 4 additions & 4 deletions lib/dispatch/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ exports.get = {
inputs: ['workspace', 'username'],
_proto: Proto.proto,
_outputExample: {},
_permission: ['manage_users'],
_permission: ['users:get'],
_dispatch: {
message: 'users:get'
},
Expand Down Expand Up @@ -276,7 +276,7 @@ exports.patch = {
inputs: ['workspace', 'username', 'user'],
_proto: Proto.proto,
_outputExample: {},
_permission: ['manage_users'],
_permission: ['users:patch'],
_dispatch: {
message: 'users:patch'
},
Expand Down Expand Up @@ -349,7 +349,7 @@ exports.delete = {
inputs: ['workspace', 'user'],
_proto: null,
_outputExample: {},
_permission: ['manage_users'],
_permission: ['users:delete'],
_dispatch: {
message: 'users:delete'
},
Expand Down Expand Up @@ -457,7 +457,7 @@ exports.verifyAPIToken = {
inputs: ['token'],
_proto: Proto.proto,
_outputExample: {},
_permission: ['access_system', 'manage_system'],
_permission: ['access_system'],
_dispatch: {
message: 'users:verifyAPIToken'
},
Expand Down

0 comments on commit d193136

Please sign in to comment.