app/models/enju_biblio/ability.rb in enju_biblio-0.1.0.pre23 vs app/models/enju_biblio/ability.rb in enju_biblio-0.1.0.pre24

- old
+ new

@@ -4,19 +4,19 @@ def initialize(user, ip_address = nil) case user.try(:role).try(:name) when 'Administrator' can [:read, :create, :update], CarrierType - can :destroy, CarrierType do |carrier_type| + can [:destroy, :delete], CarrierType do |carrier_type| true unless carrier_type.manifestations.exists? end if LibraryGroup.site_config.network_access_allowed?(ip_address) can [:read, :create, :update], Item - can :destroy, Item do |item| + can [:destroy, :delete], Item do |item| item.deletable? end can [:read, :create, :update], Manifestation - can :destroy, Manifestation do |manifestation| + can [:destroy, :delete], Manifestation do |manifestation| manifestation.items.empty? and !manifestation.periodical_master? end can :manage, [ Create, CreateType, @@ -39,11 +39,10 @@ SeriesStatement, SeriesStatementRelationship, SeriesHasManifestation ] can :update, [ - CarrierType, ContentType, Country, Extent, Frequency, FormOfWork, @@ -70,19 +69,20 @@ RequestType, ResourceImportResult ] when 'Librarian' can :manage, Item - can [:read, :create, :update], Manifestation - can :destroy, Manifestation do |manifestation| + can :index, Manifestation + can [:show, :create, :update], Manifestation + can [:destroy, :delete], Manifestation do |manifestation| manifestation.items.empty? and !manifestation.periodical_master? end can [:index, :create], Patron can :show, Patron do |patron| patron.required_role_id <= 3 end - can [:update, :destroy], Patron do |patron| + can [:update, :destroy, :delete], Patron do |patron| !patron.user.try(:has_role?, 'Librarian') and patron.required_role_id <= 3 end can :manage, [ Create, Donate, @@ -121,11 +121,12 @@ when 'User' can :index, Item can :show, Item do |item| item.required_role_id <= 2 end - can [:read, :edit], Manifestation do |manifestation| + can :index, Manifestation + can [:show, :edit], Manifestation do |manifestation| manifestation.required_role_id <= 2 end can :index, Patron can :update, Patron do |patron| patron.user == user @@ -166,10 +167,14 @@ Realize, SeriesStatement, SeriesHasManifestation ] else + can :index, Manifestation + can :show, Manifestation do |manifestation| + manifestation.required_role_id == 1 + end can :index, Patron can :show, Patron do |patron| patron.required_role_id == 1 #name == 'Guest' end can :read, [ @@ -182,10 +187,9 @@ Frequency, FormOfWork, Item, Language, License, - Manifestation, ManifestationRelationship, ManifestationRelationshipType, MediumOfPerformance, Own, PatronRelationship,