Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/Ravada.pm
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,12 @@ sub _clean_tls($self) {
$sth->execute();
}

sub _install($self) {
sub _install($self, %args) {
my $add_user_admin=1;
$add_user_admin = delete $args{add_user_admin}
if exists $args{add_user_admin};
confess "ERROR: Unknown arguments ".join(",",sort keys %args) if keys %args;

my $pid = Proc::PID::File->new(name => $self->pid_name);
$pid->file({dir => "/run/user/$>"}) if $>;
if ( $pid->alive ) {
Expand All @@ -207,7 +212,7 @@ sub _install($self) {
$self->_upgrade_timestamps();
$self->_update_data();
$self->_init_user_daemon();
$self->_init_user_admin();
$self->_init_user_admin() if $add_user_admin;
$self->_sql_insert_defaults();

$self->_do_create_constraints();
Expand Down
4 changes: 3 additions & 1 deletion script/rvd_back
Original file line number Diff line number Diff line change
Expand Up @@ -1394,7 +1394,9 @@ sub DESTROY {
{

my $rvd_back = Ravada->new(%CONFIG);
$rvd_back->_install();
my %install_args;
$install_args{add_user_admin} = 0 if $ADD_USER;
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition here should also include other user-adding options for consistency. Currently, only $ADD_USER triggers the suppression of admin user creation, but there are other user-adding options ($ADD_USER_LDAP, $ADD_USER_FILE, $ADD_USER_GROUP) that arguably should also suppress automatic admin user creation. Consider whether these other user-adding operations should also set add_user_admin to 0.

Suggested change
$install_args{add_user_admin} = 0 if $ADD_USER;
$install_args{add_user_admin} = 0 if $ADD_USER || $ADD_USER_LDAP || $ADD_USER_FILE || $ADD_USER_GROUP;

Copilot uses AI. Check for mistakes.
$rvd_back->_install(%install_args);

my @domains;
@domains = _list_domains($rvd_back
Expand Down