Commit c53f0b42 authored by Keith Jolley's avatar Keith Jolley
Browse files

Add delete_all permission.

parent 1e9bf62f
......@@ -33,6 +33,10 @@ sub print_content {
my $query = $self->get_query_from_temp_file($query_file);
my $record_name = $self->get_record_name($table);
say "<h1>Delete multiple $record_name records</h1>";
if (!$self->can_delete_all){
say q(<div class="box" id="statusbad"><p>Your user account is not allowed to delete all records.</p></div>);
return;
}
if ( $table eq 'profiles' && $query =~ /SELECT \* FROM m?v?_?scheme_(\d+)/ ) {
my $scheme_id = $1;
my $pk = $self->{'datastore'}->run_query( "SELECT field FROM scheme_fields WHERE scheme_id=? AND primary_key", $scheme_id );
......
......@@ -1617,6 +1617,12 @@ sub is_admin {
return;
}
sub can_delete_all {
my ($self) = @_;
return 1 if $self->{'permissions'}->{'delete_all'} || $self->is_admin;
return;
}
sub can_modify_table {
my ( $self, $table ) = @_;
my $q = $self->{'cgi'};
......
......@@ -241,6 +241,7 @@ sub print_additional_headerbar_functions {
sub _print_delete_all_function {
my ( $self, $table ) = @_;
return if !$self->can_delete_all;
my $q = $self->{'cgi'};
print "<fieldset><legend>Delete</legend>\n";
print $q->start_form;
......
......@@ -92,7 +92,7 @@ sub get_curator_permissions_table_attributes {
my @optlist = $self->{'system'}->{'dbtype'} eq 'isolates'
? qw (disable_access modify_users modify_usergroups set_user_passwords modify_isolates modify_projects modify_loci modify_schemes
modify_composites modify_field_attributes modify_value_attributes modify_probes modify_sequences modify_experiments tag_sequences
designate_alleles sample_management)
designate_alleles delete_all sample_management)
: qw(disable_access modify_users modify_usergroups set_user_passwords modify_loci modify_schemes);
local $" = ';';
my $attributes = [
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment