1Ravada::Auth::SQL(3)  User Contributed Perl Documentation Ravada::Auth::SQL(3)
2
3
4

NAME

6       Ravada::Auth::SQL - SQL authentication library for Ravada
7
8   BUILD
9       Internal OO build method
10
11   search_by_id
12       Searches a user by its id
13
14           my $user = Ravada::Auth::SQL->search_by_id( $id );
15
16   list_all_users
17       Returns a list of all the usernames
18
19   add_user
20       Adds a new user in the SQL database. Returns nothing.
21
22           Ravada::Auth::SQL::add_user(
23                        name => $user
24                  , password => $pass
25                  , is_admin => 0
26              , is_temporary => 0
27           );
28
29   login
30       Logins the user
31
32            my $ok = $user->login($password);
33            my $ok = Ravada::LDAP::SQL::login($name, $password);
34
35       returns true if it succeeds
36
37   make_admin
38       Makes the user admin. Returns nothing.
39
40            Ravada::Auth::SQL::make_admin($id);
41
42   remove_admin
43       Remove user admin privileges. Returns nothing.
44
45            Ravada::Auth::SQL::remove_admin($id);
46
47   external_auth
48       Sets or gets the external auth value of an user.
49
50   is_admin
51       Returns true if the user is admin.
52
53           my $is = $user->is_admin;
54
55   is_user_manager
56       Returns true if the user is user manager
57
58   is_operator
59       Returns true if the user is admin or has been granted special
60       permissions
61
62   can_list_own_machines
63       Returns true if the user can list her own virtual machines at the web
64       frontend (can_XXXXX)
65
66   can_list_clones_from_own_base
67       Returns true if the user can list all machines that are clones from his
68       bases (can_XXXXX_clones)
69
70   can_list_clones
71       Returns true if the user can list all machines that are clones and its
72       bases (can_XXXXX_clones_all)
73
74   can_list_machines
75       Returns true if the user can list all the virtual machines at the web
76       frontend (can_XXXXX_all or is_admin)
77
78   is_external
79       Returns true if the user authentication is not from SQL
80
81           my $is = $user->is_external;
82
83   is_temporary
84       Returns true if the user is admin.
85
86           my $is = $user->is_temporary;
87
88   id
89       Returns the user id
90
91           my $id = $user->id;
92
93   password_will_be_changed
94       Returns true if user password will be changed
95
96           $user->password_will_be_changed();
97
98   change_password
99       Changes the password of an User
100
101           $user->change_password();
102
103       Arguments: password
104
105   compare_password
106       Changes the input with the password of an User
107
108           $user->compare_password();
109
110       Arguments: password
111
112   language
113         Updates or selects the language selected for an User
114
115           $user->language();
116
117         Arguments: lang
118
119   remove
120       Removes the user
121
122           $user->remove();
123
124   can_do
125       Returns if the user is allowed to perform a privileged action
126
127           if ($user->can_do("remove")) {
128               ...
129
130   can_do_domain
131       Returns if the user is allowed to perform a privileged action in a
132       virtual machine
133
134           if ($user->can_do_domain("remove", $domain)) {
135               ...
136
137   grant_user_permissions
138       Grant an user permissions for normal users
139
140   grant_operator_permissions
141       Grant an user operator permissions, ie: hibernate all
142
143   grant_manager_permissions
144       Grant an user manager permissions, ie: hibernate all clones
145
146   grant_admin_permissions
147       Grant an user all the permissions
148
149   revoke_all_permissions
150       Revoke all permissions from an user
151
152   grant
153       Grant an user a specific permission, or revoke it
154
155           $admin_user->grant($user2,"clone");    # both are
156           $admin_user->grant($user3,"clone",1);  # the same
157
158           $admin_user->grant($user4,"clone",0);  # revoke a grant
159
160   revoke
161       Revoke a permission from an user
162
163           $admin_user->revoke($user2,"clone");
164
165   list_all_permissions
166       Returns a list of all the available permissions
167
168   grant_type
169       Returns the type of a grant type, currently it can be 'boolaean' or
170       'int'
171
172   list_permissions
173       Returns a list of all the permissions granted to the user
174
175       sub can_change_settings($self, $id_domain=undef) {
176           if (!defined $id_domain) {
177               return $self->can_do("change_settings");
178           }
179           return 1 if $self->can_change_settings_all();
180
181           return 0 if !$self->can_change_settings();
182
183           my $domain = Ravada::Front::Domain->open($id_domain);
184           return 1 if $self->id == $domain->id_owner;
185
186           return 0;
187       }
188
189   can_manage_machine
190       The user can change settings, remove or change other things yet to be
191       defined.  Some changes require special permissions granted.
192
193       Unlinke change_settings that any user is granted to his own machines by
194       default.
195
196   can_remove_clones
197       Returns true if the user can remove clones.
198
199       Arguments:
200
201       •   id_domain: optional
202
203   can_remove_machine
204       Return true if the user can remove this machine
205
206       Arguments:
207
208       •   domain
209
210   can_shutdown_machine
211       Return true if the user can shutdown this machine
212
213       Arguments:
214
215       •   domain
216
217   grants
218       Returns a list of permissions granted to the user in a hash
219
220   grants_info
221       Returns a list of the permissions granted to an user as a hash.  Each
222       entry is a reference to a list where the first value is the grant and
223       the second the type
224
225   ldap_entry
226       Returns the ldap entry as a Net::LDAP::Entry of the user if it has LDAP
227       external authentication
228
229   groups
230       Returns a list of the groups this user belogs to
231
232
233
234perl v5.34.1                      2022-07-03              Ravada::Auth::SQL(3)
Impressum