mirror of
https://github.com/portainer/portainer.git
synced 2025-08-05 22:05:23 +02:00
feat(global): introduce user teams and new UAC system (#868)
This commit is contained in:
parent
a380fd9adc
commit
5523fc9023
160 changed files with 7112 additions and 3166 deletions
|
@ -7,6 +7,6 @@ angular.module('portainer.rest')
|
|||
get: { method: 'GET', params: { id: '@id' } },
|
||||
update: { method: 'PUT', params: { id: '@id' } },
|
||||
updateAccess: { method: 'PUT', params: { id: '@id', action: 'access' } },
|
||||
remove: { method: 'DELETE', params: { id: '@id'} },
|
||||
remove: { method: 'DELETE', params: { id: '@id'} }
|
||||
});
|
||||
}]);
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
angular.module('portainer.rest')
|
||||
.factory('ResourceControl', ['$resource', 'USERS_ENDPOINT', function ResourceControlFactory($resource, USERS_ENDPOINT) {
|
||||
.factory('ResourceControl', ['$resource', 'RESOURCE_CONTROL_ENDPOINT', function ResourceControlFactory($resource, RESOURCE_CONTROL_ENDPOINT) {
|
||||
'use strict';
|
||||
return $resource(USERS_ENDPOINT + '/:userId/resources/:resourceType/:resourceId', {}, {
|
||||
create: { method: 'POST', params: { userId: '@userId', resourceType: '@resourceType' } },
|
||||
remove: { method: 'DELETE', params: { userId: '@userId', resourceId: '@resourceId', resourceType: '@resourceType' } },
|
||||
return $resource(RESOURCE_CONTROL_ENDPOINT + '/:id', {}, {
|
||||
create: { method: 'POST' },
|
||||
get: { method: 'GET', params: { id: '@id' } },
|
||||
update: { method: 'PUT', params: { id: '@id' } },
|
||||
remove: { method: 'DELETE', params: { id: '@id'} }
|
||||
});
|
||||
}]);
|
||||
|
|
|
@ -5,7 +5,7 @@ function isJSONArray(jsonString) {
|
|||
function isJSON(jsonString) {
|
||||
try {
|
||||
var o = JSON.parse(jsonString);
|
||||
if (o && typeof o === "object") {
|
||||
if (o && typeof o === 'object') {
|
||||
return o;
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ function isJSON(jsonString) {
|
|||
// This handler wrap the JSON objects in an array.
|
||||
// Used by the API in: Image push, Image create, Events query.
|
||||
function jsonObjectsToArrayHandler(data) {
|
||||
var str = "[" + data.replace(/\n/g, " ").replace(/\}\s*\{/g, "}, {") + "]";
|
||||
var str = '[' + data.replace(/\n/g, ' ').replace(/\}\s*\{/g, '}, {') + ']';
|
||||
return angular.fromJson(str);
|
||||
}
|
||||
|
||||
|
|
12
app/rest/team.js
Normal file
12
app/rest/team.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
angular.module('portainer.rest')
|
||||
.factory('Teams', ['$resource', 'TEAMS_ENDPOINT', function TeamsFactory($resource, TEAMS_ENDPOINT) {
|
||||
'use strict';
|
||||
return $resource(TEAMS_ENDPOINT + '/:id/:entity/:entityId', {}, {
|
||||
create: { method: 'POST' },
|
||||
query: { method: 'GET', isArray: true },
|
||||
get: { method: 'GET', params: { id: '@id' } },
|
||||
update: { method: 'PUT', params: { id: '@id' } },
|
||||
remove: { method: 'DELETE', params: { id: '@id'} },
|
||||
queryMemberships: { method: 'GET', isArray: true, params: { id: '@id', entity: 'memberships' } }
|
||||
});
|
||||
}]);
|
10
app/rest/teamMembership.js
Normal file
10
app/rest/teamMembership.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
angular.module('portainer.rest')
|
||||
.factory('TeamMemberships', ['$resource', 'TEAM_MEMBERSHIPS_ENDPOINT', function TeamMembershipsFactory($resource, TEAM_MEMBERSHIPS_ENDPOINT) {
|
||||
'use strict';
|
||||
return $resource(TEAM_MEMBERSHIPS_ENDPOINT + '/:id/:action', {}, {
|
||||
create: { method: 'POST' },
|
||||
query: { method: 'GET', isArray: true },
|
||||
update: { method: 'PUT', params: { id: '@id' } },
|
||||
remove: { method: 'DELETE', params: { id: '@id'} }
|
||||
});
|
||||
}]);
|
|
@ -1,15 +1,17 @@
|
|||
angular.module('portainer.rest')
|
||||
.factory('Users', ['$resource', 'USERS_ENDPOINT', function UsersFactory($resource, USERS_ENDPOINT) {
|
||||
'use strict';
|
||||
return $resource(USERS_ENDPOINT + '/:id/:action', {}, {
|
||||
return $resource(USERS_ENDPOINT + '/:id/:entity/:entityId', {}, {
|
||||
create: { method: 'POST' },
|
||||
query: { method: 'GET', isArray: true },
|
||||
get: { method: 'GET', params: { id: '@id' } },
|
||||
update: { method: 'PUT', params: { id: '@id' } },
|
||||
remove: { method: 'DELETE', params: { id: '@id'} },
|
||||
queryMemberships: { method: 'GET', isArray: true, params: { id: '@id', entity: 'memberships' } },
|
||||
queryTeams: { method: 'GET', isArray: true, params: { id: '@id', entity: 'teams' } },
|
||||
// RPCs should be moved to a specific endpoint
|
||||
checkPassword: { method: 'POST', params: { id: '@id', action: 'passwd' } },
|
||||
checkAdminUser: { method: 'GET', params: { id: 'admin', action: 'check' }, isArray: true },
|
||||
initAdminUser: { method: 'POST', params: { id: 'admin', action: 'init' } }
|
||||
checkPassword: { method: 'POST', params: { id: '@id', entity: 'passwd' } },
|
||||
checkAdminUser: { method: 'GET', params: { id: 'admin', entity: 'check' }, isArray: true },
|
||||
initAdminUser: { method: 'POST', params: { id: 'admin', entity: 'init' } }
|
||||
});
|
||||
}]);
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
angular.module('portainer.rest')
|
||||
.factory('Volume', ['$resource', 'Settings', 'EndpointProvider', function VolumeFactory($resource, Settings, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(Settings.url + '/:endpointId/volumes/:name/:action',
|
||||
return $resource(Settings.url + '/:endpointId/volumes/:id/:action',
|
||||
{
|
||||
name: '@name',
|
||||
endpointId: EndpointProvider.endpointID
|
||||
},
|
||||
{
|
||||
query: {method: 'GET'},
|
||||
get: {method: 'GET'},
|
||||
query: { method: 'GET' },
|
||||
get: { method: 'GET', params: {id: '@id'} },
|
||||
create: {method: 'POST', params: {action: 'create'}, transformResponse: genericHandler},
|
||||
remove: {
|
||||
method: 'DELETE', transformResponse: genericHandler
|
||||
method: 'DELETE', transformResponse: genericHandler, params: {id: '@id'}
|
||||
}
|
||||
});
|
||||
}]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue