1Ravada::Auth::SQL(3) User Contributed Perl Documentation Ravada::Auth::SQL(3)
2
3
4
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 list_permissions
169 Returns a list of all the permissions granted to the user
170
171 sub can_change_settings($self, $id_domain=undef) {
172 if (!defined $id_domain) {
173 return $self->can_do("change_settings");
174 }
175 return 1 if $self->can_change_settings_all();
176
177 return 0 if !$self->can_change_settings();
178
179 my $domain = Ravada::Front::Domain->open($id_domain);
180 return 1 if $self->id == $domain->id_owner;
181
182 return 0;
183 }
184
185 can_manage_machine
186 The user can change settings, remove or change other things yet to be
187 defined. Some changes require special permissions granted.
188
189 Unlinke change_settings that any user is granted to his own machines by
190 default.
191
192 can_remove_clones
193 Returns true if the user can remove clones.
194
195 Arguments:
196
197 • id_domain: optional
198
199 can_remove_machine
200 Return true if the user can remove this machine
201
202 Arguments:
203
204 • domain
205
206 can_shutdown_machine
207 Return true if the user can shutdown this machine
208
209 Arguments:
210
211 • domain
212
213 grants
214 Returns a list of permissions granted to the user in a hash
215
216 ldap_entry
217 Returns the ldap entry as a Net::LDAP::Entry of the user if it has LDAP
218 external authentication
219
220 groups
221 Returns a list of the groups this user belogs to
222
223
224
225perl v5.34.0 2021-10-03 Ravada::Auth::SQL(3)