1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-30 22:50:10 +03:00

Feature #1565: Clean ACL rules when a Cluster is deleted

This commit is contained in:
Carlos Martín 2013-01-23 16:46:14 +01:00
parent eeac62263c
commit 185f05a273
4 changed files with 38 additions and 0 deletions

View File

@ -108,6 +108,13 @@ public:
*/
void del_gid_rules(int gid);
/**
* Deletes rules that apply to this cluster id
*
* @param cid The cluster id
*/
void del_cid_rules(int cid);
/**
* Deletes all rules that apply to this resource
*

View File

@ -268,6 +268,8 @@ public:
};
~ClusterDelete(){};
int drop(int oid, PoolObjectSQL * object, string& error_msg);
};
/* ------------------------------------------------------------------------- */

View File

@ -624,6 +624,20 @@ void AclManager::del_gid_rules(int gid)
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void AclManager::del_cid_rules(int cid)
{
long long request = AclRule::CLUSTER_ID | cid;
long long resource_gid_mask = AclRule::CLUSTER_ID |
0x00000000FFFFFFFFLL;
// Delete rules that match
// __ __/%cid __
del_resource_matching_rules(request, resource_gid_mask);
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void AclManager::del_resource_rules(int oid, PoolObjectSQL::ObjectType obj_type)
{
long long request = obj_type |

View File

@ -210,6 +210,21 @@ int GroupDelete::drop(int oid, PoolObjectSQL * object, string& error_msg)
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
int ClusterDelete::drop(int oid, PoolObjectSQL * object, string& error_msg)
{
int rc = RequestManagerDelete::drop(oid, object, error_msg);
if ( rc == 0 )
{
aclm->del_cid_rules(oid);
}
return rc;
}
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
int UserDelete::drop(int oid, PoolObjectSQL * object, string& error_msg)
{
User * user = static_cast<User *>(object);