| Class | RightAws::Sqs::Grantee |
| In: |
lib/sqs/right_sqs.rb
|
| Parent: | Object |
| [RW] | ||
| id | [RW] | |
| name | [RW] | |
| perms | [RW] | |
| queue | [RW] |
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
324: def initialize(queue, email=nil, id=nil, name=nil, perms=[])
325: @queue = queue
326: @id = id
327: @name = name
328: @perms = perms
329: @email = email
330: retrieve unless id
331: end
Revokes all permissions for this grantee. Returns true
# File lib/sqs/right_sqs.rb, line 377
377: def drop
378: @perms.each do |permission|
379: @queue.sqs.interface.remove_grant(@queue.url, @email || @id, permission)
380: end
381: retrieve
382: true
383: 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
354: def grant(permission=nil)
355: raise "You can't grant permission without defining a grantee email address!" unless @email
356: @queue.sqs.interface.add_grant(@queue.url, @email, permission)
357: retrieve
358: 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
365: def revoke(permission='FULLCONTROL')
366: @queue.sqs.interface.remove_grant(@queue.url, @email || @id, permission)
367: unless @email # if email is unknown - just remove permission from local perms list...
368: @perms.delete(permission)
369: else # ... else retrieve updated information from Amazon
370: retrieve
371: end
372: true
373: end