Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added last role items

  • Loading branch information...
commit ab81fb4749428b7af0046ae9215b887d6dca1a5d 1 parent 8d40e89
Kristian Mandrup authored
View
13 lib/cantango/permit/helper/role_matcher.rb
@@ -0,0 +1,13 @@
+module CanTango::Permit
+ module Helper
+ module RoleMatcher
+ def role_match? candidate
+ candidate.has_role? permit_name(self.class)
+ end
+
+ def role_group_match? candidate, group_name = nil
+ candidate.is_in_group? permit_name(self.class)
+ end
+ end
+ end
+end
View
2  lib/cantango/permit/role.rb
@@ -20,6 +20,8 @@ def self.hash_key
protected
+ include CanTango::Permit::Helper::RoleMatcher
+
include CanTango::Helpers::RoleMethods
extend CanTango::Helpers::RoleMethods
View
2  lib/cantango/permit/role_group.rb
@@ -26,6 +26,8 @@ def self.hash_key
protected
+ include CanTango::Permit::Helper::RoleMatcher
+
include CanTango::Helpers::RoleMethods
extend CanTango::Helpers::RoleMethods
Please sign in to comment.
Something went wrong with that request. Please try again.