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