Creates new Grantee instance. To create new grantee for queue use:
grantee = Grantee.new(queue, grantee@email.address) grantee.grant('FULLCONTROL')
# File lib/sqs/right_sqs.rb, line 324 def initialize(queue, email=nil, id=nil, name=nil, perms=[]) @queue = queue @id = id @name = name @perms = perms @email = email retrieve unless id end
Revokes all permissions for this grantee. Returns true
# File lib/sqs/right_sqs.rb, line 377 def drop @perms.each do |permission| @queue.sqs.interface.remove_grant(@queue.url, @email || @id, permission) end retrieve true end
Adds permissions for grantee. Permission: 'FULLCONTROL' | 'RECEIVEMESSAGE' | 'SENDMESSAGE'. The caller must have set the email instance variable.
# File lib/sqs/right_sqs.rb, line 354 def grant(permission=nil) raise "You can't grant permission without defining a grantee email address!" unless @email @queue.sqs.interface.add_grant(@queue.url, @email, permission) retrieve end
Revokes permissions for grantee. Permission: 'FULLCONTROL' | 'RECEIVEMESSAGE' | 'SENDMESSAGE'. Default value is 'FULLCONTROL'. User must have +@email+ or +@id+ set. Returns true.
# File lib/sqs/right_sqs.rb, line 365 def revoke(permission='FULLCONTROL') @queue.sqs.interface.remove_grant(@queue.url, @email || @id, permission) unless @email # if email is unknown - just remove permission from local perms list... @perms.delete(permission) else # ... else retrieve updated information from Amazon retrieve end true end
Generated with the Darkfish Rdoc Generator 2.