/[smecontribs]/rpms/smeserver-nextcloud/contribs9/smeserver-nextcloud-1.1.0-bz10564-improve-shares.patch
ViewVC logotype

Contents of /rpms/smeserver-nextcloud/contribs9/smeserver-nextcloud-1.1.0-bz10564-improve-shares.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Thu Apr 12 01:19:12 2018 UTC (6 years, 7 months ago) by jpp
Branch: MAIN
CVS Tags: smeserver-nextcloud-1_1_0-19_el6_sme, smeserver-nextcloud-1_1_0-13_el6_sme, smeserver-nextcloud-1_1_0-10_el6_sme, smeserver-nextcloud-1_1_0-15_el6_sme, smeserver-nextcloud-1_1_0-8_el6_sme, smeserver-nextcloud-1_1_0-17_el6_sme, smeserver-nextcloud-1_1_0-14_el6_sme, smeserver-nextcloud-1_1_0-20_el6_sme, smeserver-nextcloud-1_1_0-18_el6_sme, smeserver-nextcloud-1_1_0-11_el6_sme, smeserver-nextcloud-1_1_0-21_el6_sme, smeserver-nextcloud-1_1_0-12_el6_sme, smeserver-nextcloud-1_1_0-9_el6_sme, smeserver-nextcloud-1_1_0-16_el6_sme, smeserver-nextcloud-1_1_0-7_el6_sme, HEAD
* Wed Apr 11 2018 Jean-Philipe Pialasse <tests@pialasse.com> 1.1.0-7.sme
- fix long update [SME: 10564]
- fix IncludeIbay not working.

1 diff -Nur smeserver-nextcloud-1.1.0.old/createlinks smeserver-nextcloud-1.1.0/createlinks
2 --- smeserver-nextcloud-1.1.0.old/createlinks 2018-04-11 00:07:43.308000000 -0400
3 +++ smeserver-nextcloud-1.1.0/createlinks 2018-04-11 00:10:26.131000000 -0400
4 @@ -27,7 +27,7 @@
5 nextcloud-del-user 60
6 ));
7
8 -foreach my $event (qw(ibay-create ibay-modify ibay-modify-files group-create group-delete group-modify user-create user-modify domain-create domain-delete domain-modify )){
9 +foreach my $event (qw(ibay-create ibay-modify ibay-modify-files group-create group-delete group-modify user-create user-modify domain-create domain-delete domain-modify share-create share-delete share-modify)){
10 event_link("nextcloud-occ-conf", $event, "30");
11 }
12
13 diff -Nur smeserver-nextcloud-1.1.0.old/root/etc/e-smith/events/actions/nextcloud-occ-conf smeserver-nextcloud-1.1.0/root/etc/e-smith/events/actions/nextcloud-occ-conf
14 --- smeserver-nextcloud-1.1.0.old/root/etc/e-smith/events/actions/nextcloud-occ-conf 2018-04-11 00:07:43.307000000 -0400
15 +++ smeserver-nextcloud-1.1.0/root/etc/e-smith/events/actions/nextcloud-occ-conf 2018-04-11 00:09:09.391000000 -0400
16 @@ -5,6 +5,7 @@
17 use esmith::util;
18 use esmith::AccountsDB;
19 use JSON;
20 +use Array::Compare;
21
22 sub OCC
23 {
24 @@ -16,6 +17,7 @@
25 {
26 my $params = join(" ", @_);
27 my $json =`TERM=dumb su - apache -s /bin/bash -c "source /opt/remi/php71/enable; cd /usr/share/nextcloud/; php occ $params"` ;
28 + $json =~ s/\s+$//;
29 return $json;
30 }
31
32 @@ -82,7 +84,7 @@
33 my $baseDN = esmith::util::ldapBase($cdb->get_value('DomainName'));
34 my $local = $cdb->get_value('LocalIP');
35 my $remote = $cdb->get_value('ExternalIP') || "";
36 -
37 +my $comp1 = Array::Compare->new;
38
39 # update trusted domains
40 OCC "config:system:set trusted_domains 0 --value=$fqdn";
41 @@ -142,10 +144,20 @@
42
43 # set ibays shares
44 foreach ( @ibays) {
45 - my $group = $_->prop('Group');
46 + my $group = $_->prop('Group') ||'';
47 my $key = $_->key;
48 my $id = "";
49 -
50 + my $typ = $_->prop('type');
51 + my @wgroups = split(',', $_->prop('WriteGroups')||'');
52 + my @rgroups = split(',', $_->prop('ReadGroups')||'');
53 + my @groups ;
54 + push @groups, @rgroups,@wgroups, split(',',$group);
55 + my @rusers = split(',', $_->prop('ReadUsers')||'');
56 + my @wusers = split(',', $_->prop('WriteUsers')||'');
57 + my @Users;
58 + push @Users,@wusers,@rusers;
59 + my @uUsers ;
60 + for (@Users) { push @uUsers, $NCusers{$_}; } ;
61 # next if includeI not empty and if not in includeI
62 next if (scalar(@incI) > 0 && grep(/^$key$/i, @incI) );
63 # next if in excludeI
64 @@ -161,11 +173,16 @@
65 if ($storage eq "smb") {
66 $id = OCCr "files_external:create -c share=$key -c host=localhost 'ibays/$key' smb password::logincredentials --output json";
67 } else {
68 - $id = OCCr "files_external:create -c datadir=/home/e-smith/files/ibays/$key 'ibays/$key' local null::null --output json";
69 + $id = OCCr "files_external:create -c datadir=/home/e-smith/files/$typ/$key 'ibays/$key' local null::null --output json";
70 + }
71 + for $group (@groups) {
72 + OCC "files_external:applicable --add-group $group $id --output json";
73 + }
74 + for my $u (@uUsers) {
75 + OCC "files_external:applicable --add-user $u $id --output json" ;
76 }
77 - OCC "files_external:applicable --add-group $group $id";
78 push @idOK,$id;
79 - print "created $key\n";
80 + print "created $typ $key : $id\n";
81 next;
82 }
83 if (scalar(@matching_keys) > 1) {
84 @@ -179,10 +196,20 @@
85
86 #if one: update if necessary
87 $id = pop @matching_keys;
88 - if (scalar(@{$localmounts{$id}{'applicable_users'}}) >0 || scalar(@{$localmounts{$id}{'applicable_groups'}}) >1 || scalar(@{$localmounts{$id}{'applicable_groups'}}) == 0 || $localmounts{$id}{'applicable_groups'}[0] ne $group) {
89 + my @a = sort(@{$localmounts{$id}{'applicable_groups'}} );
90 + my @b = sort(@groups);
91 + my @ua = sort(@{$localmounts{$id}{'applicable_users'}} );
92 + my @ub = sort(@uUsers);
93 + if ( ! $comp1->compare(\@ua, \@ub) || ! $comp1->compare(\@a, \@b) ) {
94 print "updating $key\n";
95 - OCC "files_external:applicable --remove-all $id";
96 - OCC "files_external:applicable --add-group $group $id" ;
97 + OCC "files_external:applicable --remove-all $id --output json";
98 + for $group (@groups) {
99 + OCC "files_external:applicable --add-group $group $id --output json" ;
100 + }
101 + for my $u (@uUsers) {
102 + OCC "files_external:applicable --add-user $u $id --output json" ;
103 + }
104 +
105 }
106 push @idOK,$id;
107 }
108 @@ -215,8 +242,11 @@
109 unless ( !-d $idir || !-d "$idir/files" || -d "$idir/files/ibays")
110 {
111 mkdir "$idir/files/ibays", 0770;
112 - chown $uid, $gid,"$idir/files/ibays";
113 }
114 + # we do this on every turn in case it was wrong
115 + chown $uid, $gid,"$idir/files/ibays";
116 + chmod 0770, "$idir/files/ibays";
117 + OCC "files:scan $user --quiet";
118 # we proceed next only if we want the user homes
119 next unless ($status eq "enabled");
120 # get existing mount

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed