Sha256: 4182e3ab0a53c513655338ec75529c8e37ff12b3e9ee8ad6194609dbacaab744
Contents?: true
Size: 715 Bytes
Versions: 2
Compression:
Stored size: 715 Bytes
Contents
module SocialStream class Ability include CanCan::Ability def initialize(user) can :create, Activity do |a| # All ties' authors must be the user a.tie.receiver_subject == user && a.tie.allows?(user, 'create', 'activity') end can :read, Activity do |a| # This condition would not be neccesary if every actor had a public tie with others a.tie.relation.name == 'public' || a.tie.allows?(user, 'read', 'activity') end can :update, Activity do |a| a.tie.allows?(user, 'update', 'activity') end can :destroy, Activity do |a| a.tie.allows?(user, 'destroy', 'activity') end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
social_stream-0.3.1 | lib/social_stream/ability.rb |
social_stream-0.3.0 | lib/social_stream/ability.rb |