Mojolicious-Plugin-ContextAuth

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/ContextAuth/DB.pm  view on Meta::CPAN


    my $result = $obj->delete( $id );
    if ( !$result ) {
        $self->error( $obj->error );
        return;
    }

    return $result;
}

sub update ($self, $object, $id, %params) {
    $self->error('');

    my $class = 'Mojolicious::Plugin::ContextAuth::DB::' . camelize( lc $object );
    my $obj   = $class->new( dbh => $self->dbh );

    my $found = $obj->load( $id );
    if ( !$found ) {
        $self->error( $obj->error );
        return;
    }

lib/Mojolicious/Plugin/ContextAuth/DB/Context.pm  view on Meta::CPAN

    }
    catch {
        $self->error( "Cannot delete context: " . $_ );
        $error = 1;
    };

    return if $error;
    return $result->rows;
}

sub update ($self, @params) {
    $self->error('');
    
    my $id = @params % 2 ? shift @params : $self->context_id;
    my %to_update = @params;

    if ( exists $to_update{context_name} && (
        length $to_update{context_name} > 255 ||
        length $to_update{context_name} < 3 )
    ) {
        $self->error( 'Invalid parameter' );

lib/Mojolicious/Plugin/ContextAuth/DB/Permission.pm  view on Meta::CPAN

    catch {
        $self->error( "Cannot delete permission: " . $_ );
        $error = 1;
    };

    return if $error;

    return $result->rows;
}

sub update ($self, @params) {
    $self->error('');
    
    my $id = @params % 2 ? shift @params : $self->permission_id;
    my %to_update = @params;

    if ( exists $to_update{permission_name} && (
        length $to_update{permission_name} > 255 ||
        length $to_update{permission_name} < 3
    )) {
        $self->error( 'Invalid parameter' );

lib/Mojolicious/Plugin/ContextAuth/DB/Resource.pm  view on Meta::CPAN

    }
    catch {
        $self->error( "Cannot delete resource: " . $_ );
        $error = 1;
    };

    return if $error;
    return $result->rows;
}

sub update ($self, @params) {
    $self->error('');
    
    my $id = @params % 2 ? shift @params : $self->resource_id;
    my %to_update = @params;

    if ( exists $to_update{resource_name} && (
        length $to_update{resource_name} > 255 ||
        length $to_update{resource_name} < 3
     ) ) {
        $self->error( 'Invalid parameter' );

lib/Mojolicious/Plugin/ContextAuth/DB/Role.pm  view on Meta::CPAN

    }
    catch {
        $self->error( "Cannot delete role: " . $_ );
        $error = 1;
    };

    return if $error;
    return $result->rows;
}

sub update ($self, @params) {
    $self->error('');
    
    my $id = @params % 2 ? shift @params : $self->role_id;
    my %to_update = @params;

    if ( exists $to_update{role_name} && (
        length $to_update{role_name} > 255 ||
        length $to_update{role_name} < 3 )
    ) {
        $self->error( 'Invalid parameter' );

lib/Mojolicious/Plugin/ContextAuth/DB/User.pm  view on Meta::CPAN

    }
    catch {
        $self->error( "Cannot delete user: " . $_ );
        $error = 1;
    };

    return if $error;
    return $result->rows;
}

sub update ($self, @params) {
    $self->error('');
    
    my $id = @params % 2 ? shift @params : $self->user_id;
    my %to_update = @params;

    if ( length $to_update{username} > 255 || length $to_update{username} < 3 ) {
        $self->error( 'Invalid parameter' );
        return;
    }

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.497 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )