Ravada::Auth::SQL(3)

πŸ“¦
version 2.4.1 Β· 2 versions
, in fedora 43

✨ NAME ✨

Ravada::Auth::SQL β€” the SQL authentication library for Ravada, bestie πŸ’–

Like, this is the whole entire bouncer of Ravada. Users, passwords, permissions, groups, LDAP crossover, all of it. It's giving main character energy for auth. Let's go through every single method, no skips, no cap. πŸŽ€


πŸ› οΈ BUILD

Internal OO build method. That's it, that's the whole vibe β€” it's the plumbing behind the scenes, you don't call it, it calls itself. iykyk πŸ’…


πŸ”Ž search_by_id

Searches a user by its id. Your little lookup bestie.

my $user = Ravada::Auth::SQL->search_by_id( $id );

πŸ“œ list_all_users

Returns a list of all the usernames. Everyone. The whole group chat. πŸ‘‘


βž• add_user

Adds a new user in the SQL database. Returns nothing β€” like, it does the thing and dips, no receipt. 🫢

Ravada::Auth::SQL::add_user(
             name => $user
       , password => $pass
       , is_admin => 0
   , is_temporary => 0
);

πŸ” login

Logins the user. Two ways to do it, pick your fighter:

my $ok = $user->login($password);
my $ok = Ravada::LDAP::SQL::login($name, $password);

Returns true if it succeeds. Slay. ✨


πŸ‘‘ make_admin

Makes the user admin. Returns nothing. Congrats on the promotion, no take-backsies, just vibes.

Ravada::Auth::SQL::make_admin($id);

πŸ’” remove_admin

Remove user admin privileges. Returns nothing. The crown has been returned to the vault, bestie. 😭

Ravada::Auth::SQL::remove_admin($id);

🌐 external_auth

Sets or gets the external auth value of an user. It's giving double duty β€” setter and getter, versatile icon. πŸ¦‹


🦸 is_admin

Returns true if the user is admin.

my $is = $user->is_admin;

πŸ—‚οΈ is_user_manager

Returns true if the user is user manager. Manager girlies rise πŸŽ€


🧰 is_operator

Returns true if the user is admin or has been granted special permissions. Two paths, same slay.


πŸ’» can_list_own_machines

Returns true if the user can list her own virtual machines at the web frontend (can_XXXXX).


🧬 can_list_clones_from_own_base

Returns true if the user can list all machines that are clones from his bases (can_XXXXX_clones).


πŸŒ€ can_list_clones

Returns true if the user can list all machines that are clones and its bases (can_XXXXX_clones_all).


πŸ–₯️ can_list_machines

Returns true if the user can list all the virtual machines at the web frontend (can_XXXXX_all or is_admin).


🌍 is_external

Returns true if the user authentication is not from SQL. Outsourced auth, but make it iconic.

my $is = $user->is_external;

⏳ is_temporary

Returns true if the user is admin.

Not me noticing the doc says "admin" here and not "temporary" πŸ™ˆ β€” we're just the messenger, this is exactly what the original says, fr fr.
my $is = $user->is_temporary;

πŸ†” id

Returns the user id. Your literal government name, but numbers.

my $id = $user->id;

πŸ”” password_will_be_changed

Returns true if user password will be changed. A lil heads-up notification, basically.

$user->password_will_be_changed();

πŸ”„ change_password

Changes the password of an User.

$user->change_password();

Arguments: password


πŸ§ͺ compare_password

Changes the input with the password of an User.

$user->compare_password();

Arguments: password


πŸ—£οΈ language

Updates or selects the language selected for an User.

$user->language();

Arguments: lang


🧹 remove

Removes the user. Poof. Gone. Unfollowed, blocked, deleted. πŸ’€

$user->remove();

βœ… can_do

Returns if the user is allowed to perform a privileged action.

if ($user->can_do("remove")) {
    ...

πŸ–₯️ can_do_domain

Returns if the user is allowed to perform a privileged action in a virtual machine.

if ($user->can_do_domain("remove", $domain)) {
    ...

🎁 grant_user_permissions

Grant an user permissions for normal users.


🧊 grant_operator_permissions

Grant an user operator permissions, ie: hibernate all.


πŸ§‘β€πŸ’Ό grant_manager_permissions

Grant an user manager permissions, ie: hibernate all clones.


πŸ‘‘ grant_admin_permissions

Grant an user all the permissions. Full send. 🌈


🚫 revoke_all_permissions

Revoke all permissions from an user. Everything. Back to zero, bestie.


🎟️ grant

Grant an user a specific permission, or revoke it.

$admin_user->grant($user2,"clone");    # both are
$admin_user->grant($user3,"clone",1);  # the same

$admin_user->grant($user4,"clone",0);  # revoke a grant

βœ‚οΈ revoke

Revoke a permission from an user.

$admin_user->revoke($user2,"clone");

πŸ“‹ list_all_permissions

Returns a list of all the available permissions.


🏷️ grant_type

Returns the type of a grant type, currently it can be 'boolaean' or 'int'.

Yes, 'boolaean'. That's the spelling in the original. We are not fixing it, we are respecting it. πŸ’…

πŸ”‘ list_permissions

Returns a list of all the permissions granted to the user.

sub can_change_settings($self, $id_domain=undef) {
    if (!defined $id_domain) {
        return $self->can_do("change_settings");
    }
    return 1 if $self->can_change_settings_all();

    return 0 if !$self->can_change_settings();

    my $domain = Ravada::Front::Domain->open($id_domain);
    return 1 if $self->id == $domain->id_owner;

    return 0;
}

βš™οΈ can_manage_machine

The user can change settings, remove or change other things yet to be defined. Some changes require special permissions granted.

Unlinke change_settings that any user is granted to his own machines by default.

That typo is in the original too, and honestly? It's a whole mood. Keeping it. πŸ™ˆ

πŸ—‘οΈ can_remove_clones

Returns true if the user can remove clones.

Arguments:

  • id_domain: optional

❌ can_remove_machine

Return true if the user can remove this machine.

Arguments:

  • domain

πŸ›‘ can_shutdown_machine

Return true if the user can shutdown this machine.

Arguments:

  • domain

▢️ can_start_machine

Return true if the user can shutdown this machine.

Arguments:

  • domain

πŸ“¦ grants

Returns a list of permissions granted to the user in a hash.


πŸ—ƒοΈ grants_info

Returns a list of the permissions granted to an user as a hash. Each entry is a reference to a list where the first value is the grant and the second the type.


πŸ“‡ ldap_entry

Returns the ldap entry as a Net::LDAP::Entry of the user if it has LDAP external authentication.


πŸ‘― groups

Returns a list of the groups this user belogs to.

Another original spelling, we're keeping that too, no edits no regrets 🫢

🏠 groups_local

Returns a list of the local groups this user belogs to.


πŸ’Ύ disk_used

Returns the amount of disk space used by this user in MB.


πŸ«‚ add_to_group

Adds the user to a group or list of groups.

Arguments: list of group names


πŸšͺ remove_from_group

Removes the user from a group or list of groups.

Arguments: list of group names


🌐 can_change_hardware_network

Returns true if the user can change the network in a virtual machine, false elsewhere.


πŸ—οΈ can_view_admin_machines

Returns true if the user can acess admin machines menu.

"acess" β€” yes, also original. We stan consistency in the source material. 😭

πŸ’€ POD ERRORS πŸ’€

Hey! The above document had some coding errors, which are explained below:

Around line 1215:

=pod directives shouldn't be over one line long!  Ignoring all 6
lines of content

okay so that's literally the entire page, every method, every arg, every typo preserved, no cap πŸ’– This one came from the perl v5.42.0 era, dated 2025-09-20, and it's filed under Ravada::Auth::SQL(3) in the User Contributed Perl Documentation corner of the man pages. Go be an admin about it, bestie. periodt. πŸ‘‘βœ¨πŸŽ€

πŸ“¦ where this page comes from