added role self_check and self_check_any to User store
[catagits/Catalyst-Authentication-Store-DBIx-Class.git] / t / lib / TestApp / Controller / Root.pm
index 3c1ba32..f2998de 100644 (file)
@@ -202,6 +202,46 @@ sub is_admin_user : Global {
     }
 }
 
+sub is_any_admin_user : Global {
+    my ( $self, $c ) = @_;
+
+    eval {
+        if ( $c->assert_any_user_role( qw/admin user/ ) ) {
+            $c->res->body( 'ok' );
+        }
+    };
+    if ($@) {
+        $c->res->body( 'failed' );
+    }
+}
+
+sub is_nonexistant_roles: Global {
+    my ( $self, $c ) = @_;
+
+    eval {
+        if ( $c->assert_user_roles( qw/madeUProle baconHater/ ) ) {
+            $c->res->body( 'ok' );
+        }
+    };
+    if ($@) {
+        $c->res->body( 'failed' );
+    }
+}
+
+sub is_any_nonexistant_role: Global {
+    my ( $self, $c ) = @_;
+
+    eval {
+        if ( $c->assert_any_user_role( qw/madeUProle baconHater/ ) ) {
+            $c->res->body( 'ok' );
+        }
+    };
+    if ($@) {
+        $c->res->body( 'failed' );
+    }
+}
+
+
 sub set_usersession : Global {
     my ( $self, $c, $value ) = @_;
     $c->user_session->{foo} = $value;