Module: PuppetX::EnterpriseModules::Oracle::GrantProperty
- Defined in:
- lib/puppet_x/enterprisemodules/oracle/grant_property.rb
Overview
Docs
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
- #admin_option ⇒ Object
- #after_apply ⇒ Object
- #change_to_s(_from, _to) ⇒ Object
- #common_option ⇒ Object
- #current_rights ⇒ Object
- #grant(rights) ⇒ Object
- #granted_rights ⇒ Object
- #revoke(right) ⇒ Object
- #revoked_rights ⇒ Object
- #rights_for_grantee(user, sid) ⇒ Object
Class Method Details
.included(parent) ⇒ Object
11 12 13 |
# File 'lib/puppet_x/enterprisemodules/oracle/grant_property.rb', line 11 def self.included(parent) parent.extend(ClassMethods) end |
Instance Method Details
#admin_option ⇒ Object
55 56 57 |
# File 'lib/puppet_x/enterprisemodules/oracle/grant_property.rb', line 55 def admin_option self.class.admin ? 'with admin option' : '' end |
#after_apply ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/puppet_x/enterprisemodules/oracle/grant_property.rb', line 46 def after_apply granted_rights.each do |right| sql(grant(right), :sid => resource.sid) end revoked_rights.each do |right| sql(revoke(right), :sid => resource.sid) end end |
#change_to_s(_from, _to) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/puppet_x/enterprisemodules/oracle/grant_property.rb', line 15 def change_to_s(_from, _to) return_value = [] return_value << "revoked the #{revoked_rights.join(',')} #{admin_option} right(s)" if revoked_rights.any? return_value << "granted the #{granted_rights.join(',')} #{admin_option} right(s)" if granted_rights.any? return_value.join(' and ') end |
#common_option ⇒ Object
59 60 61 62 63 64 65 66 67 |
# File 'lib/puppet_x/enterprisemodules/oracle/grant_property.rb', line 59 def common_option # # When you use this clause on a non container database, warn. # return 'container = all' if containerdb?(resource.sid) && self.class.common Puppet.warn_once('warnings', resource.path, "#{resource.path}: Ignoring container clause of non-container database.") if self.class.common '' end |
#current_rights ⇒ Object
30 31 32 |
# File 'lib/puppet_x/enterprisemodules/oracle/grant_property.rb', line 30 def current_rights rights_for_grantee(resource.grant_key, resource.sid) end |
#grant(rights) ⇒ Object
38 39 40 |
# File 'lib/puppet_x/enterprisemodules/oracle/grant_property.rb', line 38 def grant(rights) "grant #{rights} to #{resource.grant_key} #{admin_option} #{common_option}" end |
#granted_rights ⇒ Object
26 27 28 |
# File 'lib/puppet_x/enterprisemodules/oracle/grant_property.rb', line 26 def granted_rights [] end |
#revoke(right) ⇒ Object
34 35 36 |
# File 'lib/puppet_x/enterprisemodules/oracle/grant_property.rb', line 34 def revoke(right) "revoke #{right} from #{resource.grant_key} #{common_option}" end |
#revoked_rights ⇒ Object
22 23 24 |
# File 'lib/puppet_x/enterprisemodules/oracle/grant_property.rb', line 22 def revoked_rights [] end |
#rights_for_grantee(user, sid) ⇒ Object
42 43 44 |
# File 'lib/puppet_x/enterprisemodules/oracle/grant_property.rb', line 42 def rights_for_grantee(user, sid) self.class.rights_for_grantee(user, sid) end |