diff --git a/include/AuthManager.h b/include/AuthManager.h index 16e7f49d12..0d4a4dae65 100644 --- a/include/AuthManager.h +++ b/include/AuthManager.h @@ -287,7 +287,8 @@ public: INFO_POOL_MINE= 0x40LL, /**< Auth. to view user and/or group objects */ INSTANTIATE = 0x80LL, /**< Auth. to instantiate a VM from a TEMPLATE*/ CHOWN = 0x100LL,/**< Auth. to change ownership of an object */ - DEPLOY = 0x200LL /**< Auth. to deploy a VM in a Host */ + DEPLOY = 0x200LL,/**< Auth. to deploy a VM in a Host */ + CHAUTH = 0x400LL /**< Auth. to change the auth driver of a USER*/ }; static string Operation_to_str(Operation op) @@ -304,6 +305,7 @@ public: case INSTANTIATE: return "INSTANTIATE"; case CHOWN: return "CHOWN"; case DEPLOY: return "DEPLOY"; + case CHAUTH: return "CHAUTH"; default: return ""; } }; @@ -334,6 +336,7 @@ public: case USER: return "USER" ; break; case TEMPLATE: return "TEMPLATE" ; break; case GROUP: return "GROUP" ; break; + case ACL: return "ACL" ; break; default: return ""; } }; diff --git a/include/RequestManagerUser.h b/include/RequestManagerUser.h index 6730cc9f09..b28e1b8bc5 100644 --- a/include/RequestManagerUser.h +++ b/include/RequestManagerUser.h @@ -38,7 +38,7 @@ protected: pool = nd.get_upool(); auth_object = AuthRequest::USER; - auth_op = AuthRequest::MANAGE; + }; ~RequestManagerUser(){}; @@ -64,7 +64,11 @@ public: UserChangePassword(): RequestManagerUser("UserChangePassword", "Changes user's password", - "A:sis"){}; + "A:sis") + { + auth_op = AuthRequest::MANAGE; + }; + ~UserChangePassword(){}; int user_action(User * user, @@ -81,7 +85,11 @@ public: UserChangeAuth(): RequestManagerUser("UserChangeAuth", "Changes user's authentication driver", - "A:sis"){}; + "A:sis") + { + auth_op = AuthRequest::CHAUTH; + }; + ~UserChangeAuth(){}; int user_action(User * user, diff --git a/src/acl/AclRule.cc b/src/acl/AclRule.cc index 2ec3503de4..01b559d4b8 100644 --- a/src/acl/AclRule.cc +++ b/src/acl/AclRule.cc @@ -201,7 +201,7 @@ bool AclRule::malformed(string& error_str) const oss << "wrong [rights], it cannot be 0"; } - if ( rights > 0x2FFLL ) + if ( rights > 0x4FFLL ) { if ( error ) { @@ -209,7 +209,7 @@ bool AclRule::malformed(string& error_str) const } error = true; - oss << "wrong [rights], it cannot be bigger than 0x2FF"; + oss << "wrong [rights], it cannot be bigger than 0x4FF"; } if ( error ) @@ -305,12 +305,13 @@ void AclRule::build_str() AuthRequest::INFO_POOL_MINE, AuthRequest::INSTANTIATE, AuthRequest::CHOWN, - AuthRequest::DEPLOY + AuthRequest::DEPLOY, + AuthRequest::CHAUTH }; prefix = false; - for ( int i = 0; i < 10; i++ ) + for ( int i = 0; i < 11; i++ ) { if ( (rights & operations[i]) != 0 ) { diff --git a/src/cli/etc/oneacl.yaml b/src/cli/etc/oneacl.yaml index 610077d77e..c0c65e6425 100644 --- a/src/cli/etc/oneacl.yaml +++ b/src/cli/etc/oneacl.yaml @@ -18,9 +18,9 @@ :size: 5 :right: true -:OPE_CDUMIPpTWY: +:OPE_CDUMIPpTWYA: :desc: Operation to which the rule applies - :size: 14 + :size: 15 :right: true :default: @@ -28,4 +28,4 @@ - :USER - :RES_VHNIUTG - :RID -- :OPE_CDUMIPpTWY +- :OPE_CDUMIPpTWYA diff --git a/src/cli/one_helper/oneacl_helper.rb b/src/cli/one_helper/oneacl_helper.rb index dbb44276f4..93a5bae9e7 100644 --- a/src/cli/one_helper/oneacl_helper.rb +++ b/src/cli/one_helper/oneacl_helper.rb @@ -69,7 +69,7 @@ private # TODO check that @content[:resources_str] is valid def self.right_mask(str) - mask = "----------" + mask = "-----------" str.split("+").each{|type| case type @@ -93,6 +93,8 @@ private mask[8] = "W" when "DEPLOY" mask[9] = "Y" + when "CHAUTH" + mask[10] = "A" end } @@ -122,12 +124,12 @@ private d['STRING'].split(" ")[1].split("/")[1] end - column :OPE_CDUMIPpTWY, - "Operation to which the rule applies", :size =>14 do |d| + column :OPE_CDUMIPpTWYA, + "Operation to which the rule applies", :size =>15 do |d| OneAclHelper::right_mask d['STRING'].split(" ")[2] end - default :ID, :USER, :RES_VHNIUTG, :RID, :OPE_CDUMIPpTWY + default :ID, :USER, :RES_VHNIUTG, :RID, :OPE_CDUMIPpTWYA end table diff --git a/src/oca/java/src/org/opennebula/client/acl/Acl.java b/src/oca/java/src/org/opennebula/client/acl/Acl.java index d62ba502ff..a3fbf8eebc 100644 --- a/src/oca/java/src/org/opennebula/client/acl/Acl.java +++ b/src/oca/java/src/org/opennebula/client/acl/Acl.java @@ -79,6 +79,7 @@ public class Acl extends PoolElement{ tmpRights.put("INSTANTIATE" , 0x80L); tmpRights.put("CHOWN" , 0x100L); tmpRights.put("DEPLOY" , 0x200L); + tmpRights.put("CHAUTH" , 0x400L); RIGHTS = Collections.unmodifiableMap(tmpRights); } diff --git a/src/oca/ruby/OpenNebula/Acl.rb b/src/oca/ruby/OpenNebula/Acl.rb index 146c05215f..37bba80163 100644 --- a/src/oca/ruby/OpenNebula/Acl.rb +++ b/src/oca/ruby/OpenNebula/Acl.rb @@ -42,6 +42,7 @@ module OpenNebula # INSTANTIATE # CHOWN # DEPLOY + # CHAUTH class Acl < PoolElement USERS = { @@ -72,7 +73,8 @@ module OpenNebula "INFO_POOL_MINE"=> 0x40, # Auth. to view user and/or group objects "INSTANTIATE" => 0x80, # Auth. to instantiate a VM from a TEMPLATE "CHOWN" => 0x100,# Auth. to change ownership of an object - "DEPLOY" => 0x200 # Auth. to deploy a VM in a Host + "DEPLOY" => 0x200,# Auth. to deploy a VM in a Host + "CHAUTH" => 0x400 # Auth. to change the auth driver of a USER } # Constructor