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_operator
56 Returns true if the user is admin or has been granted special
57 permissions
58
59 can_list_own_machines
60 Returns true if the user can list her own virtual machines at the web
61 frontend
62
63 can_list_clones
64 Returns true if the user can list all machines that are clones and its
65 bases
66
67 can_list_clones_from_own_base
68 Returns true if the user can list all machines that are clones from his
69 bases
70
71 can_list_machines
72 Returns true if the user can list all the virtual machines at the web
73 frontend
74
75 is_external
76 Returns true if the user authentication is not from SQL
77
78 my $is = $user->is_external;
79
80 is_temporary
81 Returns true if the user is admin.
82
83 my $is = $user->is_temporary;
84
85 id
86 Returns the user id
87
88 my $id = $user->id;
89
90 change_password
91 Changes the password of an User
92
93 $user->change_password();
94
95 Arguments: password
96
97 compare_password
98 Changes the input with the password of an User
99
100 $user->compare_password();
101
102 Arguments: password
103
104 language
105 Updates or selects the language selected for an User
106
107 $user->language();
108
109 Arguments: lang
110
111 remove
112 Removes the user
113
114 $user->remove();
115
116 can_do
117 Returns if the user is allowed to perform a privileged action
118
119 if ($user->can_do("remove")) {
120 ...
121
122 can_do_domain
123 Returns if the user is allowed to perform a privileged action in a
124 virtual machine
125
126 if ($user->can_do_domain("remove", $domain)) {
127 ...
128
129 grant_user_permissions
130 Grant an user permissions for normal users
131
132 grant_operator_permissions
133 Grant an user operator permissions, ie: hibernate all
134
135 grant_manager_permissions
136 Grant an user manager permissions, ie: hibernate all clones
137
138 grant_admin_permissions
139 Grant an user all the permissions
140
141 revoke_all_permissions
142 Revoke all permissions from an user
143
144 grant
145 Grant an user a specific permission, or revoke it
146
147 $admin_user->grant($user2,"clone"); # both are
148 $admin_user->grant($user3,"clone",1); # the same
149
150 $admin_user->grant($user4,"clone",0); # revoke a grant
151
152 revoke
153 Revoke a permission from an user
154
155 $admin_user->revoke($user2,"clone");
156
157 list_all_permissions
158 Returns a list of all the available permissions
159
160 list_permissions
161 Returns a list of all the permissions granted to the user
162
163 sub can_change_settings($self, $id_domain=undef) {
164 if (!defined $id_domain) {
165 return $self->can_do("change_settings");
166 }
167 return 1 if $self->can_change_settings_all();
168
169 return 0 if !$self->can_change_settings();
170
171 my $domain = Ravada::Front::Domain->open($id_domain);
172 return 1 if $self->id == $domain->id_owner;
173
174 return 0;
175 }
176
177 can_manage_machine
178 The user can change settings, remove or change other things yet to be
179 defined. Some changes require special permissions granted.
180
181 Unlinke change_settings that any user is granted to his own machines by
182 default.
183
184 can_remove_clones
185 Returns true if the user can remove clones.
186
187 Arguments:
188
189 · id_domain: optional
190
191 can_remove_machine
192 Return true if the user can remove this machine
193
194 Arguments:
195
196 · domain
197
198 can_shutdown_machine
199 Return true if the user can shutdown this machine
200
201 Arguments:
202
203 · domain
204
205 grants
206 Returns a list of permissions granted to the user in a hash
207
208 ldap_entry
209 Returns the ldap entry as a Net::LDAP::Entry of the user if it has LDAP
210 external authentication
211
212
213
214perl v5.28.1 2019-04-12 Ravada::Auth::SQL(3)