1 |
diff -urN smeserver-shared-folders-0.3.old/root/usr/share/smanager/lib/SrvMngr/Controller/Shared_folders.pm smeserver-shared-folders-0.3/root/usr/share/smanager/lib/SrvMngr/Controller/Shared_folders.pm |
2 |
--- smeserver-shared-folders-0.3.old/root/usr/share/smanager/lib/SrvMngr/Controller/Shared_folders.pm 1970-01-01 01:00:00.000000000 +0100 |
3 |
+++ smeserver-shared-folders-0.3/root/usr/share/smanager/lib/SrvMngr/Controller/Shared_folders.pm 2020-07-31 17:14:00.000000000 +0100 |
4 |
@@ -0,0 +1,337 @@ |
5 |
+package SrvMngr::Controller::Shared_folders; |
6 |
+ |
7 |
+#---------------------------------------------------------------------- |
8 |
+# heading : Collaboration |
9 |
+# description : Shared Folders |
10 |
+# navigation : 2000 2600 |
11 |
+# |
12 |
+# name : shared_foldersget, method : get, url : /shared_folders, ctlact : Shared_folders#main |
13 |
+# name : shared_folderss, method : post, url : /shared_folders, ctlact : Shared_folders#do_save |
14 |
+# name : shared_foldersc, method : get, url : /shared_foldersc, ctlact : Shared_folders#do_create_modify |
15 |
+# name : shared_foldersc, method : post, url : /shared_foldersc, ctlact : Shared_folders#do_create_modify |
16 |
+# name : shared_foldersd, method : get, url : /shared_foldersd, ctlact : Shared_folders#do_delete |
17 |
+# name : shared_foldersp, method : get, url : /shared_foldersp, ctlact : Shared_folders#do_permissions |
18 |
+# name : shared_folderse, method : get, url : /shared_folderse, ctlact : Shared_folders#do_encrypt |
19 |
+# routes : end |
20 |
+# |
21 |
+# Documentation : https://wiki.contribs.org/SharedFolders |
22 |
+#---------------------------------------------------------------------- |
23 |
+ |
24 |
+use strict; |
25 |
+use warnings; |
26 |
+use Mojo::Base 'Mojolicious::Controller'; |
27 |
+ |
28 |
+use Locale::gettext; |
29 |
+use SrvMngr::I18N; |
30 |
+use SrvMngr qw(theme_list init_session); |
31 |
+ |
32 |
+use Data::Dumper; |
33 |
+use esmith::util; |
34 |
+use esmith::HostsDB; |
35 |
+use esmith::AccountsDB; |
36 |
+ |
37 |
+our $db = esmith::ConfigDB->open(); |
38 |
+our $adb = esmith::AccountsDB->open(); |
39 |
+ |
40 |
+our $user = 'admin'; |
41 |
+#$ENV{'REMOTE_USER'}; |
42 |
+$user = $1 if ( $user =~ /^([a-z][\-a-z0-9]*)$/ ); |
43 |
+our @usergroups = $adb->user_group_list($user); |
44 |
+ |
45 |
+use constant FALSE => 0; |
46 |
+use constant TRUE => 1; |
47 |
+ |
48 |
+my %shf_datas = (); |
49 |
+ |
50 |
+sub main { |
51 |
+ # |
52 |
+ # Main Panel |
53 |
+ # |
54 |
+ my $c = shift; |
55 |
+ $c->app->log->info( $c->log_req ); |
56 |
+ $shf_datas{first} = 'shf_FIRSTPAGE_DESC'; |
57 |
+ do_display($c); |
58 |
+} |
59 |
+ |
60 |
+sub do_display { |
61 |
+ my $c = shift; |
62 |
+ my $title = $c->l('shf_FORM_TITLE'); |
63 |
+ my $modul = ''; |
64 |
+ my @shares = get_all_shares($c); |
65 |
+ my @encryptedfolders = get_all_encrypted_shares($c); |
66 |
+ $shf_datas{trt} = 'LIST'; |
67 |
+ |
68 |
+ $c->stash( |
69 |
+ title => $title, |
70 |
+ modul => $modul, |
71 |
+ shf_datas => \%shf_datas, |
72 |
+ sharedfolders => \@shares, |
73 |
+ encryptedfolders => \@encryptedfolders, |
74 |
+ empty => ( scalar @shares == 0 ), |
75 |
+ emptye => ( scalar @encryptedfolders == 0 ) |
76 |
+ ); |
77 |
+ |
78 |
+ $c->render( template => 'shared_folders' ); |
79 |
+} |
80 |
+ |
81 |
+sub get_all_shares { |
82 |
+ my $c = shift; |
83 |
+ my @sharesdb = $adb->get_all_by_prop( type => 'share' ); |
84 |
+ my @shares = (); |
85 |
+ foreach my $sharerec (@sharesdb) { |
86 |
+ next if ( ( $sharerec->prop('Hide') || 'no' ) eq 'yes' ); |
87 |
+ my $removable = $sharerec->prop('Removable') || 'yes'; |
88 |
+ my %row = ( |
89 |
+ "Name" => $sharerec->key, |
90 |
+ "Description" => $sharerec->prop("Name"), |
91 |
+ "Removeable" => $removable |
92 |
+ ); |
93 |
+ push( @shares, \%row ); |
94 |
+ } |
95 |
+ return @shares; |
96 |
+} |
97 |
+ |
98 |
+sub get_all_encrypted_shares { |
99 |
+ |
100 |
+ my $c = shift; |
101 |
+ my @shares = $adb->get_all_by_prop( type => 'share' ); |
102 |
+ my @encfs = (); |
103 |
+ foreach (@shares) { |
104 |
+ my @sharegroups = split( /[,;]/, |
105 |
+ ( $_->prop('WriteGroups') || '' ) . ',' |
106 |
+ . ( $_->prop('ReadGroups') || '' ) ); |
107 |
+ my @shareusers = split( /[,;]/, |
108 |
+ ( $_->prop('WriteUsers') || '' ) . ',' |
109 |
+ . ( $_->prop('ReadUsers') || '' ) ); |
110 |
+ @sharegroups = keys %{ { map { $_ => 1 } @sharegroups } }; |
111 |
+ |
112 |
+ my %count = (); |
113 |
+ my @intersection = (); |
114 |
+ foreach my $element ( @sharegroups, @usergroups ) { $count{$element}++ } |
115 |
+ foreach my $element ( keys %count ) { |
116 |
+ push @intersection, $element if ( $count{$element} > 1 ); |
117 |
+ } |
118 |
+ |
119 |
+ # Only display the share in the list if encryption is enabled |
120 |
+ # and the user has at least read access |
121 |
+ if ( |
122 |
+ ( ( $_->prop('Encryption') || 'disabled' ) eq 'enabled' ) |
123 |
+ && ( ( scalar @intersection > 0 ) |
124 |
+ || ( grep { $_ eq $user } @shareusers ) |
125 |
+ || ( $user eq 'admin' ) ) |
126 |
+ ) |
127 |
+ { |
128 |
+ push @encfs, $_; |
129 |
+ } |
130 |
+ } |
131 |
+ unless ( scalar @encfs > 0 ) { |
132 |
+ return (); |
133 |
+ } |
134 |
+ |
135 |
+ my @encrypted_shares = (); |
136 |
+ foreach my $i (@encfs) { |
137 |
+ my $sharename = $i->key(); |
138 |
+ my $sharedesc = $i->prop('Name'); |
139 |
+ |
140 |
+ my $mountstatus = |
141 |
+`/bin/mount | /bin/grep /home/e-smith/files/shares/$sharename/ | grep -c fuse`; |
142 |
+ chomp($mountstatus); |
143 |
+ my $sharestatus = |
144 |
+ ( $mountstatus eq '1' ) |
145 |
+ ? $c->l('shf_ENCRYPT_MOUNTED') |
146 |
+ : $c->l('shf_ENCRYPT_NOT_MOUNTED'); |
147 |
+ |
148 |
+ my $actionMount = "shf_ENCRYPT_MOUNT" |
149 |
+ ; #$q->a({href => "${href}Mount&name=$sharename"},$self->localise('MOUNT')). ' '; |
150 |
+ |
151 |
+ my $actionUmount = 'shf_ENCRYPT_UNMOUNT' |
152 |
+ ; #$q->a({href => "${href}Umount&name=$sharename"}, $self->localise('UMOUNT')). ' '; |
153 |
+ |
154 |
+ my $action = ( $mountstatus eq '1' ) ? $actionUmount : $actionMount; |
155 |
+ |
156 |
+ my %row = ( |
157 |
+ "Name" => $sharename, |
158 |
+ "Description" => $sharedesc, |
159 |
+ "Status" => $sharestatus, |
160 |
+ "Action" => $action |
161 |
+ ); |
162 |
+ push( @encrypted_shares, \%row ); |
163 |
+ } |
164 |
+ return @encrypted_shares; |
165 |
+} |
166 |
+ |
167 |
+sub do_encrypt { |
168 |
+ # |
169 |
+ # Enable/disable encrypt share clicked |
170 |
+ # |
171 |
+ my $c = shift; |
172 |
+ $c->app->log->info( $c->log_req ); |
173 |
+ my $title = $c->l('shf_main_title'); |
174 |
+ my $modul = ''; |
175 |
+ my $mode = $c->param("mode"); |
176 |
+ |
177 |
+ #etc.... |
178 |
+ |
179 |
+ do_display($c); #If no errors |
180 |
+} |
181 |
+ |
182 |
+sub do_save { |
183 |
+ # |
184 |
+ # Save pressed |
185 |
+ # |
186 |
+ my $c = shift; |
187 |
+ $c->app->log->info( $c->log_req ); |
188 |
+ |
189 |
+ my $title = $c->l('shf_main_title'); |
190 |
+ my $modul = ''; |
191 |
+ my $mode = $c->param("mode"); |
192 |
+ |
193 |
+ #etc.... |
194 |
+ if ( $mode = "DEL" ) { |
195 |
+ my $name = $c->param("name"); |
196 |
+ my $msg = remove_share( $c, $name ); |
197 |
+ if ( $msg eq "ok" ) { |
198 |
+ $shf_datas{success} = "shf_SUCCESSFULLY_DELETED_SHARE"; |
199 |
+ } |
200 |
+ else { |
201 |
+ $shf_datas{error} = $msg; |
202 |
+ } |
203 |
+ } |
204 |
+ do_display($c); |
205 |
+ |
206 |
+} |
207 |
+ |
208 |
+sub do_delete { |
209 |
+ # |
210 |
+ # Delete/Remove clicked |
211 |
+ # |
212 |
+ my $c = shift; |
213 |
+ $c->app->log->info( $c->log_req ); |
214 |
+ |
215 |
+ my $title = $c->l('shf_REMOVE_TITLE'); |
216 |
+ my $modul = ''; |
217 |
+ |
218 |
+ #etc..... |
219 |
+ $shf_datas{trt} = 'DEL'; |
220 |
+ $c->stash( |
221 |
+ title => $title, |
222 |
+ modul => $modul, |
223 |
+ shf_datas => \%shf_datas, |
224 |
+ ); |
225 |
+ $c->render( template => 'shared_folders' ); |
226 |
+} |
227 |
+ |
228 |
+sub do_create_modify { |
229 |
+ # |
230 |
+ # Delete/Remove clicked |
231 |
+ # |
232 |
+ my $c = shift; |
233 |
+ $c->app->log->info( $c->log_req ); |
234 |
+ |
235 |
+ my $title = $c->l('shf_create_modify_title'); |
236 |
+ my $modul = ''; |
237 |
+ my $empty; |
238 |
+ |
239 |
+ #Selection options |
240 |
+ $shf_datas{disable_enable} = |
241 |
+ [ [ $c->l(''), 'disabled' ], [ $c->l(''), 'enabled' ] ]; |
242 |
+ $shf_datas{recyclebin} = [ |
243 |
+ [ $c->l('shf_DISABLED'), 'disabled' ], |
244 |
+ [ $c->l('shf_DONT_KEEP_VERSIONS'), 'enabled' ], |
245 |
+ [ $c->l('shf_KEEP_VERSIONS'), 'keep-versions' ] |
246 |
+ ]; |
247 |
+ $shf_datas{SMBaccess} = [ |
248 |
+ [ $c->l('shf_ENABLED_BROWSEABLE'), 'browseable' ], |
249 |
+ [ $c->l('shf_ENABLED_NON_BROWSEABLE'), 'non-browseable' ], |
250 |
+ [ 'No access', 'none' ] |
251 |
+ ]; |
252 |
+ $shf_datas{webaccess} = [ |
253 |
+ [ $c->l('shf_ENTIRE_INTERNET_NO_PASSWORD'), 'global' ], |
254 |
+ [ $c->l('shf_ENTIRE_INTERNET_PASSWORD'), 'global-pw' ], |
255 |
+ [ $c->l('shf_ENTIRE_INTERNET_PASSWORD_REMOTE'), 'global-pw-remote' ], |
256 |
+ [ $c->l('shf_LOCAL_NETWORK_NO_PASSWORD'), 'local' ], |
257 |
+ [ $c->l('shf_LOCAL_NETWORK_PASSWORD'), 'local-pw' ], |
258 |
+ [ $c->l('shf_NO_ACCESS'), 'None' ] |
259 |
+ ]; |
260 |
+ $shf_datas{retention} = [ |
261 |
+ [ $c->l('shf_UNLIMITED'), 'unlimited' ], |
262 |
+ [ $c->l('shf_ONE_WEEK'), 7 ], |
263 |
+ [ $c->l('shf_ONE_MONTH'), 30 ], |
264 |
+ [ $c->l('shf_SIX_MONTHS'), 180 ], |
265 |
+ [ $c->l('shf_ONE_YEAR'), 365 ] |
266 |
+ ]; |
267 |
+ my $name = $c->param("name") || ''; |
268 |
+ my @params = (); |
269 |
+ if ($name ne ''){ |
270 |
+ my $namedb = $adb->get($name); |
271 |
+ my @params = ('SMBaccess' => $namedb->get_value("SMBaccess") || '', |
272 |
+ ); |
273 |
+ } |
274 |
+ |
275 |
+ $shf_datas{param_details} = \@params; |
276 |
+ |
277 |
+ #etc..... |
278 |
+ |
279 |
+ $shf_datas{trt} = 'CR_MOD'; |
280 |
+ $c->stash( |
281 |
+ title => $title, |
282 |
+ modul => $modul, |
283 |
+ shf_datas => \%shf_datas, |
284 |
+ empty => $empty |
285 |
+ ); |
286 |
+ $c->render( template => 'shared_folders' ); |
287 |
+} |
288 |
+ |
289 |
+sub do_permisssions { |
290 |
+ # |
291 |
+ # Delete/Remove clicked |
292 |
+ # |
293 |
+ my $c = shift; |
294 |
+ $c->app->log->info( $c->log_req ); |
295 |
+ |
296 |
+ my $title = $c->l('shf_permissions_title'); |
297 |
+ my $modul = ''; |
298 |
+ |
299 |
+ #etc..... |
300 |
+ |
301 |
+ $shf_datas{trt} = 'PERM'; |
302 |
+ $c->stash( |
303 |
+ title => $title, |
304 |
+ modul => $modul, |
305 |
+ shf_datas => \%shf_datas, |
306 |
+ ); |
307 |
+ $c->render( template => 'shared_folders' ); |
308 |
+} |
309 |
+ |
310 |
+# Remove a share |
311 |
+sub remove_share { |
312 |
+ my $c = shift; |
313 |
+ my $name = shift; |
314 |
+ my $acct = $adb->get($name); |
315 |
+ |
316 |
+ #return $self->error('CANCELED','First') if ($c->param('cancel')); |
317 |
+ return 'shf_CANT_FIND_SHARE' |
318 |
+ unless ( $acct && $acct->prop('type') eq 'share' ); |
319 |
+ |
320 |
+ # Untaint $name before use in system() |
321 |
+ $name =~ /(.+)/; |
322 |
+ $name = $1; |
323 |
+ my $encryption = $acct->prop('Encryption') || 'disabled'; |
324 |
+ my $mountstatus = |
325 |
+ `/bin/mount | grep /home/e-smith/files/shares/$name/ | grep -c fuse`; |
326 |
+ chomp($mountstatus); |
327 |
+ |
328 |
+ if ( ( $encryption eq 'enabled' ) && ( $mountstatus eq '1' ) ) { |
329 |
+ return "shf_ERROR_ENCRYPTED_ENABLED"; |
330 |
+ } |
331 |
+ $acct->set_prop( 'type', 'share-deleted' ); |
332 |
+ if ( system( "/sbin/e-smith/signal-event", "share-delete", $name ) == 0 ) { |
333 |
+ $acct->delete(); |
334 |
+ } |
335 |
+ else { |
336 |
+ return "shf_ERROR_WHILE_DELETING_SHARE"; |
337 |
+ } |
338 |
+ return "ok"; |
339 |
+} |
340 |
+ |
341 |
+1; |
342 |
diff -urN smeserver-shared-folders-0.3.old/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Shared_folders/en.pm smeserver-shared-folders-0.3/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Shared_folders/en.pm |
343 |
--- smeserver-shared-folders-0.3.old/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Shared_folders/en.pm 1970-01-01 01:00:00.000000000 +0100 |
344 |
+++ smeserver-shared-folders-0.3/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Shared_folders/en.pm 2020-07-31 08:47:00.000000000 +0100 |
345 |
@@ -0,0 +1,125 @@ |
346 |
+package SrvMngr::I18N::Modules::Shared_folders::en; |
347 |
+use strict; |
348 |
+use warnings; |
349 |
+use utf8; |
350 |
+use Mojo::Base 'SrvMngr::I18N'; |
351 |
+ |
352 |
+use SrvMngr::I18N::Modules::General::en; |
353 |
+ |
354 |
+my %lexicon = ( |
355 |
+ |
356 |
+'shf_title' => 'Shared Folders', |
357 |
+'shf_FORM_TITLE' => ' Create, modify, or remove shared folders', |
358 |
+'shf_FIRSTPAGE_DESC' => ' You can remove any shared folder by clicking on the corresponding command next to the shared folder.', |
359 |
+'shf_ADD_TITLE' => ' Create or modify a shared folder', |
360 |
+'shf_NAME_FIELD_DESC' => ' The share name should contain only lower-case letters, numbers, periods, hyphens and underscores, and should start with a lower-case letter. For example "johnson", "intra", and "cust3.prj12" are all valid names, but "3associates", "John Smith" and "Bus!Partner" are not. The name is limited to [_1] characters.', |
361 |
+'shf_NAME_LABEL' => ' Shared folder name', |
362 |
+'shf_REMOVE_TITLE' => ' Remove shared folder', |
363 |
+'shf_REMOVE_DESC' => ' |
364 |
+ You are about to remove the following shared folder<br> |
365 |
+ All files belonging to this shared folder will be deleted.<br> |
366 |
+ Are you sure you wish to remove it ?<br> |
367 |
+ ', |
368 |
+'shf_ERROR_WHILE_CREATING_SHARE' => ' An error occurred while creating the shared folder.', |
369 |
+'shf_SUCCESSFULLY_CREATED_SHARE' => ' Successfully created shared folder.', |
370 |
+'shf_NO_SHARES' => ' There are no shared folders currently configured.', |
371 |
+'shf_CANT_FIND_SHARE' => ' Can\'t find account for [_1] (does it exist?)', |
372 |
+'shf_CANT_CREATE_SHARE' => ' Can\'t create new account for [_1] (does it already exist?)', |
373 |
+'shf_ERROR_WHILE_MODIFYING_SHARE' => ' An error occurred while modifying the shared folder.', |
374 |
+'shf_SUCCESSFULLY_MODIFIED_SHARE' => ' Successfully modified shared folder.', |
375 |
+'shf_SUCCESSFULLY_DELETED_SHARE' => ' Successfully deleted shared folder.', |
376 |
+'shf_ERROR_WHILE_DELETING_SHARE' => ' An error occurred while deleting the share.', |
377 |
+'shf_Shares' => |
378 |
+'Shares', |
379 |
+'shf_INVALID_SHARE_DESCRIPTION' => |
380 |
+'Error: unexpected or missing characters in share description', |
381 |
+'shf_ACCT_NAME_HAS_INVALID_CHARS' => |
382 |
+'The shared folder name "[_1]" contains invalid characters. Shared folder names must start with a lower case letter and contain only lower case letters, numbers, and hyphens.', |
383 |
+'shf_MAX_SHARE_NAME_LENGTH_ERROR' => ' The shared folder name "[_1]" is too long. The maximum is [_1] characters.', |
384 |
+'shf_ACCT_CLASHES_WITH_PSEUDONYM' => ' |
385 |
+ The account "[_1]" clashes with pseudonym details for [_2] account "[_3]". <p>[_2] is a pseudonym for [_1].</p> |
386 |
+ ', |
387 |
+'shf_ACCOUNT_EXISTS' => ' The account "[_1]" is an existing [_2] account.', |
388 |
+'shf_LABEL_ADD_SHARE_BUTTON' => ' Create a new shared folder', |
389 |
+'shf_DESC_PERMISSIONS' => ' You can use this matrix to define groups and users access permissions.', |
390 |
+'shf_DESC_SMB_SETTINGS' => ' The following settings control the access of this shared folder from the local network, using the SMB/CIFS protocol. ', |
391 |
+'shf_LABEL_SMB_ACCESS' => ' SMB Access', |
392 |
+'shf_LABEL_RECYCLEBIN' => ' Recycle bin', |
393 |
+'shf_LABEL_RETENTION' => ' Retention time', |
394 |
+'shf_UNLIMITED' => ' unlimited', |
395 |
+'shf_ONE_WEEK' => ' one week', |
396 |
+'shf_ONE_MONTH' => ' one month', |
397 |
+'shf_SIX_MONTHS' => ' six months', |
398 |
+'shf_ONE_YEAR' => ' one year', |
399 |
+'shf_DESC_HTTP_SETTINGS' => ' The following settings control the access of this shared folder using the HTTP/HTTPS protocol.', |
400 |
+'shf_LABEL_HTTP_ACCESS' => ' Web Access', |
401 |
+'shf_LABEL_WEBDAV' => ' WebDav support', |
402 |
+'shf_LABEL_REQUIRE_SSL' => ' Force secure connections', |
403 |
+'shf_LABEL_INDEXES' => ' Indexes', |
404 |
+'shf_LABEL_DYNAMIC_CONTENT' => ' Dynamic content execution (PHP, CGI, SSI)', |
405 |
+'shf_LOCAL_NETWORK_NO_PASSWORD' => 'Local network (no password required)', |
406 |
+'shf_LOCAL_NETWORK_PASSWORD' => 'Local network (password required)', |
407 |
+'shf_ENTIRE_INTERNET_NO_PASSWORD' => 'Entire Internet (no password required)', |
408 |
+'shf_ENTIRE_INTERNET_PASSWORD' => 'Entire Internet (password required)', |
409 |
+'shf_ENTIRE_INTERNET_PASSWORD_REMOTE' => 'Entire Internet (password required outside local network)', |
410 |
+'shf_NONE' => 'No access', |
411 |
+'shf_ENABLED_BROWSEABLE' => 'Enabled, browseable', |
412 |
+'shf_ENABLED_NON_BROWSEABLE' => 'Enabled, hidden', |
413 |
+'shf_DONT_KEEP_VERSIONS' => 'Enabled, keep only the latest version', |
414 |
+'shf_KEEP_VERSIONS' => 'Enabled, keep a copy of all versions', |
415 |
+'shf_PERMISSIONS' => ' Permissions', |
416 |
+'shf_WRITE_PERM' => ' Read / Write', |
417 |
+'shf_READ_PERM' => ' Read Only', |
418 |
+'shf_ENABLED' => ' enabled', |
419 |
+'shf_DISABLED' => ' disabled', |
420 |
+'shf_YES' => ' yes', |
421 |
+'shf_NO' => ' no', |
422 |
+'shf_NAME' => 'Name', |
423 |
+'shf_DESCRIPTION' => 'Description', |
424 |
+'shf_ACTION' => ' Action', |
425 |
+'shf_MODIFY' => ' Modify', |
426 |
+'shf_REMOVE' => ' Remove', |
427 |
+'shf_CANCELED' => ' Cancelled', |
428 |
+'shf_MANUAL_PERMS' => ' <span style="color:red">Permissions on this shared folder are managed manually, modifications will only affect web access if a password is required.</span><br><br>', |
429 |
+'shf_DESC_ENCRYPTION' => ' The followings options let you protect your data. If encryption is enabled, the data will never be stored in clear text on the server. Your share will either be "available" (data will appear as clear text, encryption/decryption is done on the fly), or protected (only the ciphered data is available on the server). Encryption can only be set at shared folder creation time. Also, read only groups are not supported with encrypted shared folders. If you enable encryption, only members of groups with read/write privileges will be able to access this share.', |
430 |
+'shf_LABEL_ENCRYPTION' => ' Encryption', |
431 |
+'shf_DESC_PASSWORD' => ' You need to choose a password to protect your data. This password must be at least 8 characters long. Do not loose this password. If you forget it, your data will be lost because there\'s no way to recover it.', |
432 |
+'shf_LABEL_PASSWORD' => ' Password', |
433 |
+'shf_LABEL_PASSWORD2' => ' Password (confirmation)', |
434 |
+'shf_DESC_INACTIVITY' => ' To provide additional security, you can set an inactivity time out (in minutes). When the data is available, if nobody access it for this period of time, the data will go back to protected mode automatically.', |
435 |
+'shf_INACTIVITY' => ' Inactivity timeout', |
436 |
+'shf_ERROR_WITH_ENCRYPTION' => ' An error occured while performing initial folder encryption', |
437 |
+'shf_ERROR_ENCRYPTED_ENABLED' => ' This shared folder is encrypted and access is enabled. You have to put it in protected mode before removing it', |
438 |
+'shf_INVALID_INACTIVITY' => ' Inactivity value must be numbers only', |
439 |
+'shf_PASSWORD_MISMATCH' => ' Passwords don\'t match', |
440 |
+'shf_PASSWORD_TOO_SHORT' => ' Password is too short, please use at least 8 characters', |
441 |
+'shf_DESC_PYDIO' => ' The following settings control the access of this shared folder with the web based file manager Pydio (formerly AjaXplorer)', |
442 |
+'shf_LABEL_PYDIO' => ' Pydio Access', |
443 |
+'shf_TITLE_PERMISSIONS' => ' Access right management', |
444 |
+'shf_USERS' => 'Users', |
445 |
+ |
446 |
+'shf_ENCRYPT_FORM_TITLE' => 'Shared Folders Encryption', |
447 |
+'shf_ENCRYPT_Shared Folders Encryption' => 'Shared Folders Encryption', |
448 |
+'shf_ENCRYPT_FIRSTPAGE_DESC' =>'This panel lets you enable encrypted shared folder access.', |
449 |
+'shf_ENCRYPT_STATUS' => 'Status', |
450 |
+'shf_ENCRYPT_MOUNTED' => 'Enabled', |
451 |
+'shf_ENCRYPT_NOT_MOUNTED' => 'Protected', |
452 |
+'shf_ENCRYPT_MOUNT' =>'Enable', |
453 |
+'shf_ENCRYPT_UMOUNT' => 'Protect', |
454 |
+'shf_ENCRYPT_ERROR_MOUNTING' => 'An error occured. Check that you have the correct password.', |
455 |
+'shf_ENCRYPT_UMOUNT_DESC' => 'Are you sure you want to protect this shared folder ? Once protected, the content won\'t be accessible until re-enabled with the associated password.', |
456 |
+'shf_ENCRYPT_MOUNT_DESC' => 'You have to enter the password to make this folder\'s content available.', |
457 |
+'shf_ENCRYPT_LABEL_MOUNT_PASSWORD' => 'Password', |
458 |
+'shf_ENCRYPT_VALIDATE' => 'Validate', |
459 |
+'shf_ENCRYPT_NO_ENCRYPTED_SHARE' => 'No encrypted share configured', |
460 |
+ |
461 |
+); |
462 |
+ |
463 |
+our %Lexicon = ( |
464 |
+ %{ SrvMngr::I18N::Modules::General::en::Lexicon }, |
465 |
+ %lexicon |
466 |
+); |
467 |
+ |
468 |
+ |
469 |
+1; |
470 |
+ |
471 |
diff -urN smeserver-shared-folders-0.3.old/root/usr/share/smanager/themes/default/templates/partials/_shf_create_modify.html.ep smeserver-shared-folders-0.3/root/usr/share/smanager/themes/default/templates/partials/_shf_create_modify.html.ep |
472 |
--- smeserver-shared-folders-0.3.old/root/usr/share/smanager/themes/default/templates/partials/_shf_create_modify.html.ep 1970-01-01 01:00:00.000000000 +0100 |
473 |
+++ smeserver-shared-folders-0.3/root/usr/share/smanager/themes/default/templates/partials/_shf_create_modify.html.ep 2020-07-31 17:15:00.000000000 +0100 |
474 |
@@ -0,0 +1,54 @@ |
475 |
+%# |
476 |
+%# Create or Modify shared folder |
477 |
+%# |
478 |
+<div class="shf_create_modify"> |
479 |
+ <h2> |
480 |
+ %= l('shf_ADD_TITLE') |
481 |
+ </h2> |
482 |
+ %= $c->render_to_string(inline =>l('shf_NAME_FIELD_DESC')) |
483 |
+ <br> |
484 |
+ % my $btn = $c->l('shf_ADD'); |
485 |
+ %= form_for '/shared_folders' => (method => 'POST') => begin |
486 |
+ %my $name = $c->param("name") || ''; |
487 |
+ %my $desc = $c->param("desc") || ''; |
488 |
+ <span class=label> |
489 |
+ %=l "shf_NAME_LABEL" |
490 |
+ </span> |
491 |
+ <span class=data> |
492 |
+ %= text_field name =>$name |
493 |
+ </span><br> |
494 |
+ <span class=label> |
495 |
+ %=l "shf_DESCRIPTION" |
496 |
+ </span> |
497 |
+ <span class=data> |
498 |
+ %= text_field description=>$desc |
499 |
+ </span><br> |
500 |
+ %= l('shf_DESC_SMB_SETTINGS') |
501 |
+ <span class=label> |
502 |
+ %=l "shf_LABEL_SMB_ACCESS" |
503 |
+ </span> |
504 |
+ <span class=data> |
505 |
+ % param SMBaccess => $shf_datas->{param_details}->{SMBaccess}; |
506 |
+ %= select_field SMBaccess =>$shf_datas->{SMBaccess} |
507 |
+ </span><br> |
508 |
+ <span class=label> |
509 |
+ %=l "shf_LABEL_RECYCLEBIN" |
510 |
+ </span> |
511 |
+ <span class=data> |
512 |
+ $ param recyclebin => $shf_datas->{param_details}->{recyclebin}; |
513 |
+ %= select_field recyclebin=>$shf_datas->{recyclebin} |
514 |
+ </span><br> |
515 |
+ <span class=label> |
516 |
+ %=l "shf_LABEL_RETENTION" |
517 |
+ </span> |
518 |
+ <span class=data> |
519 |
+ $ param retention => $shf_datas->{param_details}->{retention}; |
520 |
+ %= select_field retention=>$shf_datas->{retention} |
521 |
+ </span><br> |
522 |
+ %= l('shf_DESC_HTTP_SETTINGS') |
523 |
+ |
524 |
+ %= submit_button "$btn", class => 'action' |
525 |
+ % end |
526 |
+</div> |
527 |
+ |
528 |
+ |
529 |
diff -urN smeserver-shared-folders-0.3.old/root/usr/share/smanager/themes/default/templates/partials/_shf_delete.html.ep smeserver-shared-folders-0.3/root/usr/share/smanager/themes/default/templates/partials/_shf_delete.html.ep |
530 |
--- smeserver-shared-folders-0.3.old/root/usr/share/smanager/themes/default/templates/partials/_shf_delete.html.ep 1970-01-01 01:00:00.000000000 +0100 |
531 |
+++ smeserver-shared-folders-0.3/root/usr/share/smanager/themes/default/templates/partials/_shf_delete.html.ep 2020-07-30 06:26:00.000000000 +0100 |
532 |
@@ -0,0 +1,33 @@ |
533 |
+%# |
534 |
+%# Delete shared folder |
535 |
+%# |
536 |
+<div class="shf_delete"> |
537 |
+ <h2> |
538 |
+ %= l('shf_REMOVE_TITLE') |
539 |
+ </h2> |
540 |
+ %= $c->render_to_string(inline =>l('shf_REMOVE_DESC')) |
541 |
+ <br> |
542 |
+ % my $btn = $c->l('shf_REMOVE'); |
543 |
+ %= form_for '/shared_folders' => (method => 'POST') => begin |
544 |
+ %my $name = $c->param("name"); |
545 |
+ %my $desc = $c->param("desc") || ''; |
546 |
+ <span class=label> |
547 |
+ %=l "shf_NAME" |
548 |
+ </span> |
549 |
+ <span class=data> |
550 |
+ %= $name |
551 |
+ </span><br> |
552 |
+ <span class=label> |
553 |
+ %=l "shf_DESCRIPTION" |
554 |
+ </span> |
555 |
+ <span class=data> |
556 |
+ %= $desc |
557 |
+ </span><br> |
558 |
+ %= hidden_field mode=>"DEL" |
559 |
+ %= hidden_field name=>$name |
560 |
+ %= hidden_field desc=>$desc |
561 |
+ %= submit_button "$btn", class => 'action' |
562 |
+ % end |
563 |
+</div> |
564 |
+ |
565 |
+ |
566 |
diff -urN smeserver-shared-folders-0.3.old/root/usr/share/smanager/themes/default/templates/partials/_shf_list.html.ep smeserver-shared-folders-0.3/root/usr/share/smanager/themes/default/templates/partials/_shf_list.html.ep |
567 |
--- smeserver-shared-folders-0.3.old/root/usr/share/smanager/themes/default/templates/partials/_shf_list.html.ep 1970-01-01 01:00:00.000000000 +0100 |
568 |
+++ smeserver-shared-folders-0.3/root/usr/share/smanager/themes/default/templates/partials/_shf_list.html.ep 2020-07-31 08:49:00.000000000 +0100 |
569 |
@@ -0,0 +1,94 @@ |
570 |
+<div id='shf_list'> |
571 |
+ |
572 |
+ % my $btn = l('shf_LABEL_ADD_SHARE_BUTTON'); |
573 |
+ |
574 |
+ %= form_for '/shared_foldersc' => (method => 'POST') => begin |
575 |
+ <br> |
576 |
+ %= submit_button "$btn", class => 'action' |
577 |
+ <br> |
578 |
+ |
579 |
+ %# Table of shares |
580 |
+ |
581 |
+ % if ($empty){ |
582 |
+ <div class=sme-error> |
583 |
+ %=l 'shf_NO_SHARES' |
584 |
+ </div> |
585 |
+ % } else { |
586 |
+ |
587 |
+ <table class="sme-border"><tbody> |
588 |
+ <tr> |
589 |
+ <th class='sme-border'> |
590 |
+ %=l 'NAME' |
591 |
+ </th> |
592 |
+ <th class='sme-border'> |
593 |
+ %=l 'DESCRIPTION' |
594 |
+ </th> |
595 |
+ <th class='sme-border' colspan=3> |
596 |
+ %=l 'shf_ACTION' |
597 |
+ </th> |
598 |
+ </tr> |
599 |
+ % foreach my $sharedfolder (@$sharedfolders) { |
600 |
+ <tr> |
601 |
+ %= t td => (class => 'sme-border') => $sharedfolder->{"Name"} |
602 |
+ %= t td => (class => 'sme-border') => $sharedfolder->{"Description"} |
603 |
+ <td class=sme-border> |
604 |
+ <a href="/smanager/shared_foldersp?mode=PERM&name=<%= $sharedfolder->{"Name"}%>"><%=l 'shf_PERMISSIONS'%></a> |
605 |
+ </td> |
606 |
+ <td class=sme-border> |
607 |
+ <a href="/smanager/shared_foldersc?mode=MOD&name=<%= $sharedfolder->{"Name"}%>"><%=l 'MODIFY'%></a> |
608 |
+ </td> |
609 |
+ % |
610 |
+ <td class=sme-border> |
611 |
+ <a href="/smanager/shared_foldersd?mode=DEL&name=<%= $sharedfolder->{"Name"}%>&desc=<%= $sharedfolder->{"Description"}%>"><%=l 'REMOVE'%></a> |
612 |
+ </td> |
613 |
+ </tr> |
614 |
+ %} |
615 |
+ </tbody> |
616 |
+ </table> |
617 |
+ %} |
618 |
+ |
619 |
+ %#Table of encrypted shares |
620 |
+ <hr><h2> |
621 |
+ %=l 'shf_ENCRYPT_FORM_TITLE' |
622 |
+ </h2> |
623 |
+ %=l 'shf_ENCRYPT_FIRSTPAGE_DESC' |
624 |
+ <br> |
625 |
+ % if ($emptye){ |
626 |
+ <div class=sme-error> |
627 |
+ %=l 'shf_ENCRYPT_NO_ENCRYPTED_SHARE' |
628 |
+ </div> |
629 |
+ % } else { |
630 |
+ |
631 |
+ |
632 |
+ <table class="sme-border"><tbody> |
633 |
+ <tr> |
634 |
+ <th class='sme-border'> |
635 |
+ %=l 'NAME' |
636 |
+ </th> |
637 |
+ <th class='sme-border'> |
638 |
+ %=l 'DESCRIPTION' |
639 |
+ </th> |
640 |
+ <th class='sme-border'> |
641 |
+ %=l 'shf_ENCRYPT_STATUS' |
642 |
+ </th> |
643 |
+ <th class='sme-border' colspan=3> |
644 |
+ %=l 'shf_ACTION' |
645 |
+ </th> |
646 |
+ </tr> |
647 |
+ % foreach my $encryptedfolder (@$encryptedfolders) { |
648 |
+ <tr> |
649 |
+ %= t td => (class => 'sme-border') => $encryptedfolder->{"Name"} |
650 |
+ %= t td => (class => 'sme-border') => $encryptedfolder->{"Description"} |
651 |
+ %= t td => (class => 'sme-border') => $c->l($encryptedfolder->{"Status"}) |
652 |
+ % my $action = $encryptedfolder->{"Action"}; |
653 |
+ % my $actiondesc = $c->l("$action"); |
654 |
+ <td class='sme-border'><a href='/smanager/shared_folderse?name=<%= $encryptedfolder->{"Name"}%>&mode=<%=$actiondesc%>'><%=$actiondesc%></a></td> |
655 |
+ </tr> |
656 |
+ %} |
657 |
+ </tbody> |
658 |
+ </table> |
659 |
+ |
660 |
+ % } |
661 |
+ |
662 |
+ % end |
663 |
+</div> |
664 |
diff -urN smeserver-shared-folders-0.3.old/root/usr/share/smanager/themes/default/templates/partials/_shf_permisssions.html.ep smeserver-shared-folders-0.3/root/usr/share/smanager/themes/default/templates/partials/_shf_permisssions.html.ep |
665 |
--- smeserver-shared-folders-0.3.old/root/usr/share/smanager/themes/default/templates/partials/_shf_permisssions.html.ep 1970-01-01 01:00:00.000000000 +0100 |
666 |
+++ smeserver-shared-folders-0.3/root/usr/share/smanager/themes/default/templates/partials/_shf_permisssions.html.ep 2020-07-24 12:31:00.000000000 +0100 |
667 |
@@ -0,0 +1,59 @@ |
668 |
+%# |
669 |
+%# Delete shared folder |
670 |
+%# |
671 |
+<div class="shf_delete"> |
672 |
+ % my $btn = $c->l('SAVE'); |
673 |
+ % my $MailServer = $shf_datas->{mailserver}; |
674 |
+ |
675 |
+ %= form_for '/shared_folders_save' => (method => 'POST') => begin |
676 |
+ <br> |
677 |
+ % my $domain = $c->param('domain'); |
678 |
+ %=$c->render_to_string(inline =>l('shf_Delegate_Domain',$domain)) |
679 |
+ <br> |
680 |
+ <span class=label> |
681 |
+ %=l "shf_Server_or_IP" |
682 |
+ </span> |
683 |
+ <span class=data> |
684 |
+ %=text_field 'MailServer' =>$MailServer |
685 |
+ </span> |
686 |
+ <br><br> |
687 |
+ %if ($empty) { |
688 |
+ %=$c->l('shf_No_pseudonyms_for',$domain); |
689 |
+ <br> |
690 |
+ <a href="/smanager/shared_folders3?domain=<%=$domain %>&mode=new"><button type='button'><%= $c->l('shf_Click_Here')%></button></a> |
691 |
+ %=$c->render_to_string(inline=>l('shf_Click_Here_first')) |
692 |
+ <br> |
693 |
+ |
694 |
+ %} else { |
695 |
+ %=$c->l('shf_Current_list_for',$domain); |
696 |
+ <br> |
697 |
+ <a href="/smanager/shared_folders3?domain=<%=$domain %>&mode=new"><button type='button'><%= $c->l('shf_Click_Here')%></button></a> |
698 |
+ %=$c->render_to_string(inline=>l('shf_Click_Here_add')) |
699 |
+ <br><br> |
700 |
+ |
701 |
+ %#Table of pseudonyms: |
702 |
+ <table class="sme-border"><tbody> |
703 |
+ <tr> |
704 |
+ <th class='sme-border'> |
705 |
+ %=l 'shf_Pseudonyms' |
706 |
+ </th> |
707 |
+ <th class='sme-border'> |
708 |
+ %=l 'shf_Local_User' |
709 |
+ </th> |
710 |
+ <th class='sme-border'> |
711 |
+ </th> |
712 |
+ <th class='sme-border' '> |
713 |
+ </th> |
714 |
+ </tr> |
715 |
+ </tbody> |
716 |
+ </table> |
717 |
+ %} |
718 |
+ |
719 |
+ <br> |
720 |
+ %=$c->render_to_string(inline =>l('shf_Need_Save')); |
721 |
+ <br> |
722 |
+ %= submit_button "$btn", class => 'action' |
723 |
+ % end |
724 |
+</div> |
725 |
+ |
726 |
+ |
727 |
diff -urN smeserver-shared-folders-0.3.old/root/usr/share/smanager/themes/default/templates/shared_folders.html.ep smeserver-shared-folders-0.3/root/usr/share/smanager/themes/default/templates/shared_folders.html.ep |
728 |
--- smeserver-shared-folders-0.3.old/root/usr/share/smanager/themes/default/templates/shared_folders.html.ep 1970-01-01 01:00:00.000000000 +0100 |
729 |
+++ smeserver-shared-folders-0.3/root/usr/share/smanager/themes/default/templates/shared_folders.html.ep 2020-07-24 12:13:00.000000000 +0100 |
730 |
@@ -0,0 +1,43 @@ |
731 |
+% layout 'default', title => "Sme server 2 - Shared Folders", share_dir => './'; |
732 |
+ |
733 |
+% content_for 'module' => begin |
734 |
+<div id="module"> |
735 |
+ |
736 |
+ % if ($config->{debug} == 1) { |
737 |
+ <p> |
738 |
+ %= dumper $c->current_route |
739 |
+ </p> |
740 |
+ % } |
741 |
+ |
742 |
+ <h1><%=$title%></h1> |
743 |
+ %= $modul |
744 |
+ |
745 |
+ %if ($shf_datas->{first}) { |
746 |
+ %=$c->render_to_string(inline =>$c->l($shf_datas->{first})) |
747 |
+ |
748 |
+ %} elsif ($shf_datas->{success}) { |
749 |
+ <div class='sme-success'> |
750 |
+ <h2> Operation Status Report</h2> |
751 |
+ %= $c->l($shf_datas->{success}); |
752 |
+ </div> |
753 |
+ |
754 |
+ %} elsif ($shf_datas->{error}) { |
755 |
+ <div class='sme-error'> |
756 |
+ <h2> Operation Status Report - error</h2> |
757 |
+ %= $c->l($shf_datas->{error}); |
758 |
+ </div> |
759 |
+ %} |
760 |
+ |
761 |
+ |
762 |
+ % if ($shf_datas->{trt} eq 'CR_MOD') { |
763 |
+ %= include 'partials/_shf_create_modify' |
764 |
+ %} elsif ($shf_datas->{trt} eq 'DEL') { |
765 |
+ %= include 'partials/_shf_delete' |
766 |
+ %} elsif ($shf_datas->{trt} eq 'PERM') { |
767 |
+ %= include 'partials/_shf_permissions' |
768 |
+ %} else { |
769 |
+ %= include 'partials/_shf_list' |
770 |
+ %} |
771 |
+ |
772 |
+</div> |
773 |
+%end |