Created
November 29, 2012 12:43
-
-
Save nicomen/4168822 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Bazaar-Schema/lib/Bazaar/Schema/Result/User.pm b/Bazaar-Schema/lib/Bazaar/Schema/Result/User.pm | |
index 6c816ed..9704625 100644 | |
--- a/Bazaar-Schema/lib/Bazaar/Schema/Result/User.pm | |
+++ b/Bazaar-Schema/lib/Bazaar/Schema/Result/User.pm | |
@@ -78,15 +78,19 @@ has_many favorites => 'Bazaar::Schema::Result::Favorite' => | |
many_to_many favorite_items => 'favorites', 'item'; | |
has_many items => 'Bazaar::Schema::Result::Item' => | |
- {'foreign.owner_id' => 'self.id'}; | |
- | |
- | |
- | |
-sub is_user { 1 } | |
-sub is_admin { shift->user_level > 1 } | |
-sub is_moderator { shift->user_level > 2 } | |
-sub is_supervisor { shift->user_level > 5 } | |
-sub is_superadmin { shift->user_level > 9 } | |
+ {'foreign.owner_id' => 'self.id'}; | |
+ | |
+our $USER = 0b000000001; | |
+our $ADMIN = 0b000000010; | |
+our $MODERATOR = 0b000000100; | |
+our $SUPERVISOR = 0b000001000; | |
+our $SUPERADMIN = 0b000010000; | |
+ | |
+sub is_user { $USER } | |
+sub is_admin { shift->user_level & $ADMIN } | |
+sub is_moderator { shift->user_level & $MODERATOR } | |
+sub is_supervisor { shift->user_level & $SUPERVISOR } | |
+sub is_superadmin { shift->user_level & $SUPERADMIN } | |
sub insert { | |
my $self = shift; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment