summaryrefslogtreecommitdiff
path: root/server/core/Identity.php
diff options
context:
space:
mode:
authorYoggzo <yogg@epsina.com>2016-02-24 13:23:47 +0100
committerYoggzo <yogg@epsina.com>2016-02-24 13:23:47 +0100
commitfafb5eeaa4676823680c828ac57adf2e855b7afd (patch)
tree58c914ba9b277252daf53c27e878f262cb4579ad /server/core/Identity.php
parent16e0328884f318d97ac991ee8e70f43ee1c14b38 (diff)
parentd2f5ae5c83ef5bc41cf430ace79769459b4acbf8 (diff)
Merge branch 'develop' into Evan
Diffstat (limited to 'server/core/Identity.php')
-rwxr-xr-xserver/core/Identity.php188
1 files changed, 83 insertions, 105 deletions
diff --git a/server/core/Identity.php b/server/core/Identity.php
index 00199ec..2638985 100755
--- a/server/core/Identity.php
+++ b/server/core/Identity.php
@@ -25,9 +25,6 @@ class identity implements Core{
/** @var OpenStack\Identity $libClass protected, contains the library Identity object */
protected $libClass;
-
- /** @var array $actions protected, contains the functions which can be call by the front-end */
- protected $actions = array();
/**
* identity constructor
@@ -44,10 +41,20 @@ class identity implements Core{
$this->libClass = $app->getLibClass("Identity");
}
-
- $credentials = array();
/**
+ * Execute an action
+ *
+ * @param String $action name of another function of this class
+ *
+ * @return void
+ */
+ public function action($action){
+
+ $this->{$action.""}();
+
+ }
+ /**
* Add a credential for the given user/project.
*
* Create a secret/access pair for use with ec2 style auth.
@@ -60,7 +67,7 @@ class identity implements Core{
*
* @return void
*/
- $credentials["addCredential"] = function(){
+ private function addCredential(){
$blob = $this->app->getPostParam("blob");
$projectId = $this->app->getPostParam("projectId");
@@ -96,7 +103,7 @@ class identity implements Core{
*
* @return void
*/
- $credentials["listCredentials"] = function(){
+ private function listCredentials(){
try{
$this->libClass->listCredentials()
@@ -122,7 +129,7 @@ class identity implements Core{
*
* @return void
*/
- $credentials["showCredential"] = function(){
+ private function showCredential(){
$credentId = $this->app->getPostParam("credentialId");
if(!isset($credentId)){
@@ -157,7 +164,7 @@ class identity implements Core{
*
* @return void
*/
- $credentials["updateCredential"] = function(){
+ private function updateCredential(){
$credentId = $this->app->getPostParam("credentialId");
$blob = $this->app->getPostParam("blob");
@@ -197,7 +204,7 @@ class identity implements Core{
*
* @return void
*/
- $credentials["deleteCredential"] = function(){
+ private function deleteCredential(){
$credentId = $this->app->getPostParam("credentialId");
@@ -223,8 +230,6 @@ class identity implements Core{
}
}-
- $domains = array();
-
/**
* Add a domain to an OpenStack instance.
*
@@ -234,7 +239,7 @@ class identity implements Core{
*
* @return void
*/
- $domains["addDomain"] = function(){
+ private function addDomain(){
$description = $this->app->getPostParam("desc");
$enabled = $this->app->getPostParam("enabled");
@@ -277,7 +282,7 @@ class identity implements Core{
*
* @return void
*/
- $domains["listDomains"] = function(){
+ private function listDomains(){
try{
@@ -304,7 +309,7 @@ class identity implements Core{
*
* @return void
*/
- $domains["showDomain"] = function(){
+ private function showDomain(){
$domId = $this->app->getPostParam("domainId");
@@ -340,7 +345,7 @@ class identity implements Core{
*
* @return void
*/
- $domains["updateDomain"] = function(){
+ private function updateDomain(){
$domId = $this->app->getPostParam("domainId");
$description = $this->app->getPostParam("desc");
@@ -386,7 +391,7 @@ class identity implements Core{
*
* @return void
*/
- $domains["deleteDomain"] = function(){
+ private function deleteDomain(){
$domId = $this->app->getPostParam("domainId");
@@ -419,7 +424,7 @@ class identity implements Core{
*
* @return void
*/
- $domains["listRolesDomainUser"] = function(){
+ private function listRolesDomainUser(){
$domId = $this->app->getPostParam("domainId");
$userId = $this->app->getPostParam("userId");
@@ -454,7 +459,7 @@ class identity implements Core{
*
* @return void
*/
- $domains["grantRoleDomainUser"] = function(){
+ private function grantRoleDomainUser(){
$domId = $this->app->getPostParam("domainId");
$roleId = $this->app->getPostParam("roleId");
$userId = $this->app->getPostParam("userId");
@@ -492,7 +497,7 @@ class identity implements Core{
*
* @return void
*/
- $domains["checkRoleDomainUser"] = function(){
+ private function checkRoleDomainUser(){
$domId = $this->app->getPostParam("domainId");
$roleId = $this->app->getPostParam("roleId");
$userId = $this->app->getPostParam("userId");
@@ -531,7 +536,7 @@ class identity implements Core{
*
* @return void
*/
- $domains["revokeRoleDomainUser"] = function(){
+ private function revokeRoleDomainUser(){
$domId = $this->app->getPostParam("domainId");
$roleId = $this->app->getPostParam("roleId");
$userId = $this->app->getPostParam("userId");
@@ -569,7 +574,7 @@ class identity implements Core{
*
* @return void
*/
- $domains["listRolesDomainGroup"] = function(){
+ private function listRolesDomainGroup(){
$domId = $this->app->getPostParam("domainId");
$groupId = $this->app->getPostParam("groupId");
@@ -604,7 +609,7 @@ class identity implements Core{
*
* @return void
*/
- $domains["grantRoleDomainGroup"] = function(){
+ private function grantRoleDomainGroup(){
$domId = $this->app->getPostParam("domainId");
$groupId = $this->app->getPostParam("groupId");
$roleId = $this->app->getPostParam("roleId");
@@ -642,7 +647,7 @@ class identity implements Core{
*
* @return void
*/
- $domains["checkRoleDomainGroup"] = function(){
+ private function checkRoleDomainGroup(){
$domId = $this->app->getPostParam("domainId");
$groupId = $this->app->getPostParam("groupId");
$roleId = $this->app->getPostParam("roleId");
@@ -687,7 +692,7 @@ class identity implements Core{
*
* @return void
*/
- $domains["revokeRoleDomainGroup"] = function(){
+ private function revokeRoleDomainGroup(){
$domId = $this->app->getPostParam("domainId");
$groupId = $this->app->getPostParam("groupId");
$roleId = $this->app->getPostParam("roleId");
@@ -719,8 +724,6 @@ class identity implements Core{
}
}
- $endpoints = array();
-
/**
* Add an endpoint to the Openstack instance
*
@@ -728,7 +731,7 @@ class identity implements Core{
*
* @return void
*/
- $endpoints["addEndpoint"] = function(){
+ private function addEndpoint(){
$servId = $this->app->getPostParam("serviceId");
$name = $this->app->getPostParam("name");
$region = $this->app->getPostParam("region");
@@ -768,7 +771,7 @@ class identity implements Core{
*
* @return void
*/
- $endpoints["getEndpoint"] = function(){
+ private function getEndpoint(){
$endId = $this->app->getPostParam("endpointId");
@@ -798,7 +801,7 @@ class identity implements Core{
*
* @return void
*/
- $endpoints["listEndpoints"] = function(){
+ private function listEndpoints(){
try{
@@ -824,7 +827,7 @@ class identity implements Core{
*
* @return void
*/
- $endpoints["updateEndpoint"] = function(){
+ private function updateEndpoint(){
//Not Implemented Yet
/*$domId = $this->app->getPostParam("domainId");
@@ -863,7 +866,7 @@ class identity implements Core{
*
* @return void
*/
- $endpoints["deleteEndpoint"] = function(){
+ private function deleteEndpoint(){
$endId = $this->app->getPostParam("endpointId");
if(!isset($endId)){
@@ -888,8 +891,6 @@ class identity implements Core{
}
}
- $groups = array();
-
/**
* Add a group.
*
@@ -897,7 +898,7 @@ class identity implements Core{
*
* @return void
*/
- $groups["addGroup"] = function(){
+ private function addGroup(){
//Not Implemented Yet
/*$domId = $this->app->getPostParam("domainId");
@@ -930,7 +931,7 @@ class identity implements Core{
*
* @return void
*/
- $groups["listGroups"] = function(){
+ private function listGroups(){
//Not Implemented Yet
/*
$domId = $this->app->getPostParam("domainId");
@@ -963,7 +964,7 @@ class identity implements Core{
*
* @return void
*/
- $groups["showGroup"] = function(){
+ private function showGroup(){
//Not Implemented Yet
/*
@@ -997,7 +998,7 @@ class identity implements Core{
*
* @return void
*/
- $groups["updateGroup"] = function(){
+ private function updateGroup(){
//Todo Argument Optional
$groupId = $this->app->getPostParam("groupId");
$description = $this->app->getPostParam("description");
@@ -1038,7 +1039,7 @@ class identity implements Core{
*
* @return void
*/
- $groups["deleteGroup"] = function(){
+ private function deleteGroup(){
$groupId = $this->app->getPostParam("groupId");
@@ -1072,7 +1073,7 @@ class identity implements Core{
*
* @return void
*/
- $groups["listGroupUsers"] = function(){
+ private function listGroupUsers(){
$groupId = $this->app->getPostParam("groupId");
@@ -1106,7 +1107,7 @@ class identity implements Core{
*
* @return void
*/
- $groups["addGroupUser"] = function(){
+ private function addGroupUser(){
$userId = $this->app->getPostParam("userId");
$groupId = $this->app->getPostParam("groupId");
@@ -1141,7 +1142,7 @@ class identity implements Core{
*
* @return void
*/
- $groups["removeGroupUser"] = function(){
+ private function removeGroupUser(){
$userId = $this->app->getPostParam("userId");
$groupId = $this->app->getPostParam("groupId");
@@ -1176,7 +1177,7 @@ class identity implements Core{
*
* @return void
*/
- $groups["checkGroupUser"] = function(){
+ private function checkGroupUser(){
$userId = $this->app->getPostParam("userId");
$groupId = $this->app->getPostParam("groupId");
@@ -1204,8 +1205,6 @@ class identity implements Core{
}
}
- $policies = array();
-
/**
* @todo
*
@@ -1213,7 +1212,7 @@ class identity implements Core{
*
* @return void
*/
- $policies["addPolicies"] = function(){
+ private function addPolicies(){
//Not Implemented Yet
/*
$domId = $this->app->getPostParam("domainId");
@@ -1246,7 +1245,7 @@ class identity implements Core{
*
* @return void
*/
- $policies["listPolicies"] = function(){
+ private function listPolicies(){
//Not Implemented Yet
/*
$domId = $this->app->getPostParam("domainId");
@@ -1279,7 +1278,7 @@ class identity implements Core{
*
* @return void
*/
- $policies["showPolicie"] = function(){
+ private function showPolicie(){
//Not Implemented Yet
/*
$domId = $this->app->getPostParam("domainId");
@@ -1313,7 +1312,7 @@ class identity implements Core{
*
* @return void
*/
- $policies["updatePolicies"] = function(){
+ private function updatePolicies(){
//Not Implemented Yet
/*
$domId = $this->app->getPostParam("domainId");
@@ -1346,7 +1345,7 @@ class identity implements Core{
*
* @return void
*/
- $policies["deletePolicies"] = function(){
+ private function deletePolicies(){
//Not Implemented Yet
/*
$domId = $this->app->getPostParam("domainId");
@@ -1372,8 +1371,6 @@ class identity implements Core{
}*/
}
- $projects = array();
-
/**
* Add a project.
*
@@ -1381,7 +1378,7 @@ class identity implements Core{
*
* @return void
*/
- $projects["addProject"] = function(){
+ private function addProject(){
//Todo Parameters Optional
$description = $this->app->getPostParam("description");
$name = $this->app->getPostParam("name");
@@ -1416,7 +1413,7 @@ class identity implements Core{
*
* @return void
*/
- $projects["listProjects"] = function(){
+ private function listProjects(){
try{
@@ -1442,7 +1439,7 @@ class identity implements Core{
*
* @return void
*/
- $projects["showProject"] = function(){
+ private function showProject(){
$projId = $this->app->getPostParam("projetId");
@@ -1475,7 +1472,7 @@ class identity implements Core{
*
* @return void
*/
- $projects["updateProject"] = function(){
+ private function updateProject(){
//Todo Parameters Optionnal
$description = $this->app->getPostParam("description");
$name = $this->app->getPostParam("name");
@@ -1515,7 +1512,7 @@ class identity implements Core{
*
* @return void
*/
- $projects["deleteProject"] = function(){
+ private function deleteProject(){
$projId = $this->app->getPostParam("projId");
if(!isset($projId)){
@@ -1548,7 +1545,7 @@ class identity implements Core{
*
* @return void
*/
- $projects["listRolesProjectUser"] = function(){
+ private function listRolesProjectUser(){
$projId = $this->app->getPostParam("projetId");
$userId = $this->app->getPostParam("userId");
@@ -1583,7 +1580,7 @@ class identity implements Core{
*
* @return void
*/
- $projects["grantRoleProjectUser"] = function(){
+ private function grantRoleProjectUser(){
$projId = $this->app->getPostParam("projId");
$userId = $this->app->getPostParam("userId");
@@ -1622,7 +1619,7 @@ class identity implements Core{
*
* @return void
*/
- $projects["checkRoleProjectUser"] = function(){
+ private function checkRoleProjectUser(){
$projId = $this->app->getPostParam("projetId");
$userId = $this->app->getPostParam("userId");
$roleId = $this->app->getPostParam("roleId");
@@ -1663,7 +1660,7 @@ class identity implements Core{
*
* @return void
*/
- $projects["revokeRoleProjectUser"] = function(){
+ private function revokeRoleProjectUser(){
$projId = $this->app->getPostParam("projetId");
$userId = $this->app->getPostParam("userId");
@@ -1702,7 +1699,7 @@ class identity implements Core{
*
* @return void
*/
- $projects["listRolesProjectGroup"] = function(){
+ private function listRolesProjectGroup(){
$projId = $this->app->getPostParam("projetId");
$groupId = $this->app->getPostParam("groupId");
@@ -1738,7 +1735,7 @@ class identity implements Core{
*
* @return void
*/
- $projects["grantRoleProjectGroup"] = function(){
+ private function grantRoleProjectGroup(){
$projId = $this->app->getPostParam("projetId");
$userId = $this->app->getPostParam("userId");
@@ -1777,7 +1774,7 @@ class identity implements Core{
*
* @return void
*/
- $projects["checkRoleProjectGroup"] = function(){
+ private function checkRoleProjectGroup(){
$projId = $this->app->getPostParam("projetId");
$userId = $this->app->getPostParam("userId");
@@ -1818,7 +1815,7 @@ class identity implements Core{
*
* @return void
*/
- $projects["revokeRoleProjectGroup"] = function(){
+ private function revokeRoleProjectGroup(){
$projId = $this->app->getPostParam("projetId");
$userId = $this->app->getPostParam("userId");
@@ -1850,8 +1847,6 @@ class identity implements Core{
}
}
- $roles = array();
-
/**
* Add a role.
*
@@ -1859,7 +1854,7 @@ class identity implements Core{
*
* @return void
*/
- $roles["addRole"] = function(){
+ private function addRole(){
$name = $this->app->getPostParam("name");
@@ -1891,7 +1886,7 @@ class identity implements Core{
*
* @return void
*/
- $roles["listRoles"] = function(){
+ private function listRoles(){
try{
@@ -1915,7 +1910,7 @@ class identity implements Core{
*
* @return void
*/
- $roles["listRoleAssignements"] = function(){
+ private function listRoleAssignements(){
try{
@@ -1934,8 +1929,6 @@ class identity implements Core{
}
}
- $services = array();
-
/**
* Add a service.
*
@@ -1943,7 +1936,7 @@ class identity implements Core{
*
* @return void
*/
- $services["addService"] = function(){
+ private function addService(){
$name = $this->app->getPostParam("name");
$type = $this->app->getPostParam("type");
@@ -1976,7 +1969,7 @@ class identity implements Core{
*
* @return void
*/
- $services["listServices"] = function(){
+ private function listServices(){
try{
@@ -2002,7 +1995,7 @@ class identity implements Core{
*
* @return void
*/
- $services["showService"] = function(){
+ private function showService(){
$servId = $this->app->getPostParam("serviceId");
if(!isset($servId)){
@@ -2033,7 +2026,7 @@ class identity implements Core{
*
* @return void
*/
- $services["deleteService"] = function(){
+ private function deleteService(){
$servId = $this->app->getPostParam("serviceId");
$groupId = $this->app->getPostParam("groupId");
@@ -2060,8 +2053,6 @@ class identity implements Core{
}
}
- $tokens = array();
-
/**
* Generate a new token for a given user id.
*
@@ -2069,7 +2060,7 @@ class identity implements Core{
*
* @return void
*/
- $tokens["genTokenUserID"] = function(){
+ private function genTokenUserID(){
$userId = $this->app->getPostParam("userId");
$userPass = $this->app->getPostParam("userPassword");
@@ -2107,7 +2098,7 @@ class identity implements Core{
*
* @return void
*/
- $tokens["genTokenUserName"] = function(){
+ private function genTokenUserName(){
$username = $this->app->getPostParam("username");
$userPass = $this->app->getPostParam("userPassword");
$domId = $this->app->getPostParam("domainId");
@@ -2149,7 +2140,7 @@ class identity implements Core{
*
* @return void
*/
- $tokens["geneTokenID"] = function(){
+ private function genTokenID(){
$tokenId = $this->app->getPostParam("tokenId");
$projectId = $this->app->getPostParam("projectId");
@@ -2185,7 +2176,7 @@ class identity implements Core{
*
* @return void
*/
- $tokens["genTokenScopedProjectID"] = function(){
+ private function genTokenScopedProjectID(){
$userId = $this->app->getPostParam("userId");
$userPass = $this->app->getPostParam("userPass");
@@ -2227,7 +2218,7 @@ class identity implements Core{
*
* @return void
*/
- $tokens["genTokenScopedProjectName"] = function(){
+ private function genTokenScopedProjectName(){
$userId = $this->app->getPostParam("userId");
$userPass = $this->app->getPostParam("userPass");
@@ -2275,7 +2266,7 @@ class identity implements Core{
*
* @return void
*/
- $tokens["validateToken"] = function(){
+ private function validateToken(){
$tokenId = $this->app->getPostParam("tokenId");
@@ -2311,7 +2302,7 @@ class identity implements Core{
*
* @return void
*/
- $tokens["revokeToken"] = function(){
+ private function revokeToken(){
$tokenId = $this->app->getPostParam("tokenId");
@@ -2336,8 +2327,6 @@ class identity implements Core{
}
}
- $users = array();
-
/**
* Add a new user.
*
@@ -2345,7 +2334,7 @@ class identity implements Core{
*
* @return void
*/
- $users["addUser"] = function(){
+ private function addUser(){
//Todo Optionnal Parameter
$projId = $this->app->getPostParam("projId");
$desc = $this->app->getPostParam("description");
@@ -2388,7 +2377,7 @@ class identity implements Core{
*
* @return void
*/
- $users["listUsers"] = function(){
+ private function listUsers(){
try{
@@ -2414,7 +2403,7 @@ class identity implements Core{
*
* @return void
*/
- $users["showUser"] = function(){
+ private function showUser(){
$userId = $this->app->getPostParam("userId");
@@ -2447,7 +2436,7 @@ class identity implements Core{
*
* @return void
*/
- $users["updateUser"] = function(){
+ private function updateUser(){
$userId = $this->app->getPostParam("userId");
$desc = $this->app->getPostParam("description");
@@ -2486,7 +2475,7 @@ class identity implements Core{
*
* @return void
*/
- $users["deleteUser"] = function(){
+ private function deleteUser(){
$userId = $this->app->getPostParam("userId");
@@ -2519,7 +2508,7 @@ class identity implements Core{
*
* @return void
*/
- $users["listUserGroups"] = function(){
+ private function listUserGroups(){
$userId = $this->app->getPostParam("userId");
@@ -2553,7 +2542,7 @@ class identity implements Core{
*
* @return void
*/
- $users["listUserProjects"] = function(){
+ private function listUserProjects(){
$userId = $this->app->getPostParam("userId");
@@ -2579,15 +2568,4 @@ class identity implements Core{
$this->app->getErrorInstance->NotImplementedHandler($e);
}
}
-
- $actions["Credentials"] = $credentials;
- $actions["Domains"] = $domains;
- $actions["Endpoints"] = $endpoints;
- $actions["Groups"] = $groups;
- $actions["Policies"] = $policies;
- $actions["Projects"] = $projects;
- $actions["Roles"] = $roles;
- $actions["Services"] = $services;
- $actions["Tokens"] = $tokens;
- $actions["Users"] = $users;
}