mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-23 17:33:56 +03:00
Feature #2672: Remove uneeded getter. add some comments
This commit is contained in:
parent
9aca04fb7f
commit
93377e0ba6
@ -37,13 +37,13 @@ class AclManager : public Callbackable, public ActionListener
|
||||
{
|
||||
public:
|
||||
|
||||
AclManager(SqlDB * _db, int zone_id, bool _refresh_cache, time_t timer_period);
|
||||
|
||||
AclManager(int _zone_id)
|
||||
:zone_id(_zone_id), db(0),lastOID(0), is_federation_slave(false)
|
||||
{
|
||||
pthread_mutex_init(&mutex, 0);
|
||||
};
|
||||
/**
|
||||
* @param _db pointer to the DB
|
||||
* @param zone_id of the Zone
|
||||
* @param refresh_cache will reload periodically rules from the DB
|
||||
* @param timer_period period to reload the rules
|
||||
*/
|
||||
AclManager(SqlDB * _db, int zone_id, bool _refresh_cache, time_t timer);
|
||||
|
||||
virtual ~AclManager();
|
||||
|
||||
@ -89,8 +89,8 @@ public:
|
||||
* -2 if the rule is malformed,
|
||||
* -3 if the DB insert failed
|
||||
*/
|
||||
virtual int add_rule(long long user,
|
||||
long long resource,
|
||||
virtual int add_rule(long long user,
|
||||
long long resource,
|
||||
long long rights,
|
||||
long long zone,
|
||||
string& error_str);
|
||||
@ -204,6 +204,17 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* Constructor for derived ACL managers. Classes derived from this one
|
||||
* will operate in a stand-alone fashion (i.e. no refresh of ACL rules
|
||||
* from DB)
|
||||
*/
|
||||
AclManager(int _zone_id)
|
||||
:zone_id(_zone_id), db(0),lastOID(0), is_federation_slave(false)
|
||||
{
|
||||
pthread_mutex_init(&mutex, 0);
|
||||
};
|
||||
|
||||
// ----------------------------------------
|
||||
// ACL rules management
|
||||
// ----------------------------------------
|
||||
@ -302,11 +313,6 @@ private:
|
||||
|
||||
int zone_id;
|
||||
|
||||
int get_zone_id() const
|
||||
{
|
||||
return zone_id;
|
||||
};
|
||||
|
||||
// ----------------------------------------
|
||||
// Mutex synchronization
|
||||
// ----------------------------------------
|
||||
@ -412,7 +418,7 @@ private:
|
||||
/**
|
||||
* Flag to refresh the cache periodically
|
||||
*/
|
||||
bool is_federation_slave;
|
||||
bool is_federation_slave;
|
||||
|
||||
/**
|
||||
* Timer period for the cache refresh loop.
|
||||
|
@ -53,8 +53,8 @@ AclManager::AclManager(
|
||||
int _zone_id,
|
||||
bool _is_federation_slave,
|
||||
time_t _timer_period)
|
||||
:zone_id(_zone_id), db(_db), lastOID(-1), is_federation_slave(_is_federation_slave),
|
||||
timer_period(_timer_period)
|
||||
:zone_id(_zone_id), db(_db), lastOID(-1),
|
||||
is_federation_slave(_is_federation_slave), timer_period(_timer_period)
|
||||
{
|
||||
ostringstream oss;
|
||||
|
||||
@ -287,7 +287,7 @@ const bool AclManager::authorize(
|
||||
AclRule::INDIVIDUAL_ID | uid,
|
||||
log_resource,
|
||||
rights_req,
|
||||
AclRule::INDIVIDUAL_ID | get_zone_id());
|
||||
AclRule::INDIVIDUAL_ID | zone_id);
|
||||
|
||||
oss << "Request " << log_rule.to_str();
|
||||
NebulaLog::log("ACL",Log::DDEBUG,oss);
|
||||
@ -458,7 +458,7 @@ bool AclManager::match_rules(
|
||||
multimap<long long, AclRule *>::iterator> index;
|
||||
|
||||
long long zone_oid_mask = AclRule::INDIVIDUAL_ID | 0x00000000FFFFFFFFLL;
|
||||
long long zone_req = AclRule::INDIVIDUAL_ID | get_zone_id();
|
||||
long long zone_req = AclRule::INDIVIDUAL_ID | zone_id;
|
||||
long long zone_all_req = AclRule::ALL_ID;
|
||||
|
||||
index = rules.equal_range( user_req );
|
||||
@ -896,7 +896,7 @@ void AclManager::reverse_search(int uid,
|
||||
( obj_type | AclRule::CLUSTER_ID );
|
||||
|
||||
long long zone_oid_req =
|
||||
AclRule::INDIVIDUAL_ID | get_zone_id();
|
||||
AclRule::INDIVIDUAL_ID | zone_id;
|
||||
|
||||
long long zone_all_req = AclRule::ALL_ID;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user