spree/spree — pull request #3969 by danxexe (2013-11-14 19:39:10+00:00)
Title: Order submenu broken for custom roles

There are 2 issues with the ability checks on the order submenu when using custom roles:

- Conditions using `&&` are not working as expected (`&&` operator takes precedence over `can?` method call)
- `can?` calls are not following cancan conventions of passing a model instance or class.

These fixes allow a custom ability class like the following to work as expected:

```ruby
module Spree
class ShopkeeperAbility
include CanCan::Ability

def initialize(user)
user ||= Spree.user_class.new

if user.respond_to?(:has_spree_role?) && user.has_spree_role?('shopkeeper')
can :manage, Spree::Order
can :manage, Spree::Adjustment
can :manage, Spree::Payment
can :manage, Spree::ReturnAuthorization
end

end
end
end
```