Ravada::Auth::SQL - SQL authentication library for Ravada
Internal OO build method
Searches a user by its id
my $user = Ravada::Auth::SQL->search_by_id( $id );
Adds a new user in the SQL database. Returns nothing.
Ravada::Auth::SQL::add_user( name => $user , password => $pass , is_admin => 0 , is_temporary => 0 );
Logins the user
my $ok = $user->login($password); my $ok = Ravada::LDAP::SQL::login($name, $password);
returns true if it succeeds
Makes the user admin. Returns nothing.
Ravada::Auth::SQL::make_admin($id);
Remove user admin privileges. Returns nothing.
Ravada::Auth::SQL::remove_admin($id);
Returns true if the user is admin.
my $is = $user->is_admin;
Returns true if the user authentication is not from SQL
my $is = $user->is_external;
Returns true if the user is admin.
my $is = $user->is_temporary;
Returns the user id
my $id = $user->id;
Changes the password of an User
$user->change_password();
Arguments: password
Updates or selects the language selected for an User $user->language(); Arguments: lang
Removes the user
$user->remove();
Returns if the user is allowed to perform a privileged action
if ($user->can_do("remove")) { ...
Grant an user permissions for normal users
Grant an user operator permissions, ie: hibernate all
Grant an user manager permissions, ie: hibernate all clones
Grant an user all the permissions
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 a permission from an user
$admin_user->revoke($user2,"clone");
Returns a list of all the available permissions
Returns a list of all the permissions granted to the user