app/models/enju_biblio/ability.rb in enju_biblio-0.1.0.pre69 vs app/models/enju_biblio/ability.rb in enju_biblio-0.1.0.pre70

- old
+ new

@@ -57,54 +57,64 @@ SeriesStatement, SeriesStatementMerge, SeriesStatementMergeList ] can :manage, [ - AgentType, Country, Language, License, MediumOfPerformance ] - can :manage, [ + can [:destroy, :delete], [ ContentType, Frequency ] do |record| record.manifestations.empty? end if LibraryGroup.site_config.network_access_allowed?(ip_address) - can :read, [ + can [:destroy, :delete], [ + AgentType + ] do |record| + record.agents.empty? + end if LibraryGroup.site_config.network_access_allowed?(ip_address) + can [:create, :read, :update], [ + AgentType, + AgentImportResult, CarrierType, ContentType, Country, Frequency, FormOfWork, IdentifierType, Language, License, MediumOfPerformance, - AgentImportResult, - AgentType, ResourceImportResult ] when 'Librarian' can :manage, Item can [:destroy, :delete], Item do |item| item.removable? end - can :index, Manifestation - can [:show, :create, :update], Manifestation + can [:index, :create], Manifestation + can [:show, :update], Manifestation do |manifestation| + manifestation.required_role_id <= 3 + end can [:destroy, :delete], Manifestation do |manifestation| - if manifestation.items.empty? - if manifestation.series_master? - if manifestation.children.empty? - true + if manifestation.required_role_id <= 3 + if manifestation.items.empty? + if manifestation.series_master? + if manifestation.children.empty? + true + else + false + end else - false + true end - else - true end + else + false end end can [:index, :create], Agent can :show, Agent do |agent| agent.required_role_id <= 3 @@ -131,23 +141,23 @@ SeriesStatement, SeriesStatementMerge, SeriesStatementMergeList ] can :read, [ + AgentType, + AgentImportResult, + AgentRelationshipType, CarrierType, ContentType, Country, Frequency, FormOfWork, IdentifierType, Language, License, ManifestationRelationshipType, - AgentImportResult, - AgentRelationshipType, - AgentType, - ResourceImportResult, - MediumOfPerformance + MediumOfPerformance, + ResourceImportResult ] when 'User' can :index, Item can :show, Item do |item| item.required_role_id <= 2