Sha256: 375b2a41d84e1c852fd2f882979cb90c02dd22c10613a84bc01513913b8cfc2b

Contents?: true

Size: 767 Bytes

Versions: 24

Compression:

Stored size: 767 Bytes

Contents

class UserSubject < Checkin::Subject

      role :guest, :alias => :anonymous do
          !subject_model
      end

      role :logged_in, :alias => [:connected] do
          !!subject_model
      end

      role :owner, :require => [:logged_in], :method => :own do |object|
          object && ( object.respond_to?(:author) && ( subject_model == object.author ) ) ||  ( object.respond_to?(:owner) && ( subject_model == object.owner ) )
      end
      
      role :administrator, :require => :logged_in, :alias => :admin do
          subject_model && subject_model.is_a?(Superuser)
      end

      #
      # Permissions
      #

      # Admin

      scope :admin do
        permissions do
          allow :administrators
          deny
        end
      end

end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
fullstack-admin-0.2.5 lib/generators/fullstack/admin/templates/root/lib/support/user_subject.rb
fullstack-admin-0.2.4 lib/generators/fullstack/admin/templates/root/lib/support/user_subject.rb
fullstack-admin-0.2.3 lib/generators/fullstack/admin/templates/root/lib/support/user_subject.rb
fullstack-admin-0.2.2 lib/generators/fullstack/admin/templates/root/lib/support/user_subject.rb