New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Splits off the logic from sharees endpoint thus making it available from within Nc/via PHP. #6328

Merged
merged 24 commits into from Oct 4, 2017

Conversation

Projects
None yet
5 participants
@blizzz
Member

blizzz commented Aug 31, 2017

@schiessle as discussed yesterday. Took a bit more effort, because i decided to split off the different getters to Plugins. However, I did not create a register function or anything. Can be added later if it becomes necessary. Right now, I doubt this and want to keep effort small. I did not touch tests, yet, however Smoke tests with the share dialog worked for me. Are you OK with that approach?

necessary for #2443

P.S.: Context: @schiessle prefered to have the logic outside of the Sharing scope, due to his concern that a universal API is established again. Therefore we thought the Collaborator terminology could fit.

@mention-bot

This comment has been minimized.

Show comment
Hide comment
@mention-bot

mention-bot Aug 31, 2017

@blizzz, thanks for your PR! By analyzing the history of the files in this pull request, we identified @nickvergessen, @rullzer and @schiessle to be potential reviewers.

mention-bot commented Aug 31, 2017

@blizzz, thanks for your PR! By analyzing the history of the files in this pull request, we identified @nickvergessen, @rullzer and @schiessle to be potential reviewers.

@blizzz blizzz requested review from nickvergessen, daita and schiessle Aug 31, 2017

@blizzz blizzz added this to the Nextcloud 13 milestone Aug 31, 2017

@daita

This comment has been minimized.

Show comment
Hide comment
@daita

daita Sep 2, 2017

Member

could be fun to merge with #5280

Member

daita commented Sep 2, 2017

could be fun to merge with #5280

@blizzz

This comment has been minimized.

Show comment
Hide comment
@blizzz

blizzz Sep 3, 2017

Member

on first glance, i did not see conflict potential. different controller and endpoint.

Member

blizzz commented Sep 3, 2017

on first glance, i did not see conflict potential. different controller and endpoint.

@codecov

This comment has been minimized.

Show comment
Hide comment
@codecov

codecov bot Sep 5, 2017

Codecov Report

Merging #6328 into master will increase coverage by 2.51%.
The diff coverage is 70.43%.

@@             Coverage Diff              @@
##             master    #6328      +/-   ##
============================================
+ Coverage     53.06%   55.57%   +2.51%     
+ Complexity    22570    21264    -1306     
============================================
  Files          1417     1261     -156     
  Lines         87810    73270   -14540     
  Branches       1340        0    -1340     
============================================
- Hits          46597    40723    -5874     
+ Misses        41213    32547    -8666
Impacted Files Coverage Δ Complexity Δ
lib/private/Server.php 83.47% <20%> (-0.78%) 124 <1> (+1)
lib/private/App/InfoParser.php 89.18% <25%> (-2.4%) 63 <0> (+3)
lib/private/legacy/app.php 53.83% <33.33%> (-0.12%) 220 <0> (+2)
...private/Collaboration/Collaborators/MailPlugin.php 58.75% <58.75%> (ø) 19 <19> (?)
...ivate/Collaboration/Collaborators/SearchResult.php 62.96% <62.96%> (ø) 12 <12> (?)
...es_sharing/lib/Controller/ShareesAPIController.php 70% <63.63%> (+5.52%) 24 <3> (-90) ⬇️
...ivate/Collaboration/Collaborators/RemotePlugin.php 73.33% <73.33%> (ø) 17 <17> (?)
lib/private/Collaboration/Collaborators/Search.php 76.92% <76.92%> (ø) 12 <12> (?)
...ivate/Collaboration/Collaborators/LookupPlugin.php 79.31% <79.31%> (ø) 5 <5> (?)
...rivate/Collaboration/Collaborators/GroupPlugin.php 80.76% <80.76%> (ø) 16 <16> (?)
... and 385 more

codecov bot commented Sep 5, 2017

Codecov Report

Merging #6328 into master will increase coverage by 2.51%.
The diff coverage is 70.43%.

@@             Coverage Diff              @@
##             master    #6328      +/-   ##
============================================
+ Coverage     53.06%   55.57%   +2.51%     
+ Complexity    22570    21264    -1306     
============================================
  Files          1417     1261     -156     
  Lines         87810    73270   -14540     
  Branches       1340        0    -1340     
============================================
- Hits          46597    40723    -5874     
+ Misses        41213    32547    -8666
Impacted Files Coverage Δ Complexity Δ
lib/private/Server.php 83.47% <20%> (-0.78%) 124 <1> (+1)
lib/private/App/InfoParser.php 89.18% <25%> (-2.4%) 63 <0> (+3)
lib/private/legacy/app.php 53.83% <33.33%> (-0.12%) 220 <0> (+2)
...private/Collaboration/Collaborators/MailPlugin.php 58.75% <58.75%> (ø) 19 <19> (?)
...ivate/Collaboration/Collaborators/SearchResult.php 62.96% <62.96%> (ø) 12 <12> (?)
...es_sharing/lib/Controller/ShareesAPIController.php 70% <63.63%> (+5.52%) 24 <3> (-90) ⬇️
...ivate/Collaboration/Collaborators/RemotePlugin.php 73.33% <73.33%> (ø) 17 <17> (?)
lib/private/Collaboration/Collaborators/Search.php 76.92% <76.92%> (ø) 12 <12> (?)
...ivate/Collaboration/Collaborators/LookupPlugin.php 79.31% <79.31%> (ø) 5 <5> (?)
...rivate/Collaboration/Collaborators/GroupPlugin.php 80.76% <80.76%> (ø) 16 <16> (?)
... and 385 more
@nickvergessen

This comment has been minimized.

Show comment
Hide comment
@nickvergessen

nickvergessen Sep 6, 2017

Member

Nice cleanup, I always disliked the naming anyway.
I would be fine to use a new route and just have two routes linking to the the same class/method.

Member

nickvergessen commented Sep 6, 2017

Nice cleanup, I always disliked the naming anyway.
I would be fine to use a new route and just have two routes linking to the the same class/method.

@blizzz

This comment has been minimized.

Show comment
Hide comment
@blizzz

blizzz Sep 6, 2017

Member

I would be fine to use a new route and just have two routes linking to the the same class/method.

From within cire, pointing to the files_sharing controller? It might be disabled… We could move this, too, or think about a new Controller in the server… but this I see in a follow-up PR, rather.

Member

blizzz commented Sep 6, 2017

I would be fine to use a new route and just have two routes linking to the the same class/method.

From within cire, pointing to the files_sharing controller? It might be disabled… We could move this, too, or think about a new Controller in the server… but this I see in a follow-up PR, rather.

blizzz added a commit to nextcloud/circles that referenced this pull request Sep 6, 2017

add the collaborator search plugin
required for nextcloud/server#6328

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>

@blizzz blizzz referenced this pull request Sep 6, 2017

Merged

add the collaborator search plugin #126

0 of 1 task complete
@blizzz

This comment has been minimized.

Show comment
Hide comment
@blizzz

blizzz Sep 6, 2017

Member

@nickvergessen so I moved the Circles plugin to its own app (nextcloud/circles#126) → registering Plugins works.

Also, the result types are not fixed but filled by the plugins. I added a public class for this to have type name validated.

The LookupPlugin might go to the Federation files_sharing app (since it acts on its config), however this is a special case, because this is not activate by a provided share type, but a flag 😒 but this can be dealt with, with some extra effort.

Also, the MailPlugin can go to 'sharebymail' app, unless something speaks against it ( @schiessle ?), and the RemotePlugin to 'federation'.

Member

blizzz commented Sep 6, 2017

@nickvergessen so I moved the Circles plugin to its own app (nextcloud/circles#126) → registering Plugins works.

Also, the result types are not fixed but filled by the plugins. I added a public class for this to have type name validated.

The LookupPlugin might go to the Federation files_sharing app (since it acts on its config), however this is a special case, because this is not activate by a provided share type, but a flag 😒 but this can be dealt with, with some extra effort.

Also, the MailPlugin can go to 'sharebymail' app, unless something speaks against it ( @schiessle ?), and the RemotePlugin to 'federation'.

@blizzz

This comment has been minimized.

Show comment
Hide comment
@blizzz

blizzz Sep 13, 2017

Member

Now 🤹‍ with the ShareeAPIController unit tests was exciting 💤 ;)

Member

blizzz commented Sep 13, 2017

Now 🤹‍ with the ShareeAPIController unit tests was exciting 💤 ;)

@blizzz blizzz added 3. to review and removed 2. developing labels Sep 14, 2017

@blizzz

This comment has been minimized.

Show comment
Hide comment
@blizzz

blizzz Sep 14, 2017

Member

I kept LookupPlugin inside lib/…, because it is involved differently for whatever reason (invocation by explicit flag, not ShareType). Since there is no dedicated ShareType, I refrain to change this.

This said, I'd be happy about final reviews 😸

Member

blizzz commented Sep 14, 2017

I kept LookupPlugin inside lib/…, because it is involved differently for whatever reason (invocation by explicit flag, not ShareType). Since there is no dedicated ShareType, I refrain to change this.

This said, I'd be happy about final reviews 😸

@blizzz blizzz requested review from rullzer and LukasReschke Sep 14, 2017

@daita

daita approved these changes Sep 15, 2017

@daita

This comment has been minimized.

Show comment
Hide comment
@daita

daita Sep 15, 2017

Member

Tested with Circles, working !

We need to edit https://apps.nextcloud.com/schema/apps/info.xsd for

	<collaboration>
		<collaborators>
			<searchPlugins>
				<searchPlugin>
					<class></class>
					<shareType></shareType>
				</searchPlugin>
			</searchPlugins>
		</collaborators>
	</collaboration>
Member

daita commented Sep 15, 2017

Tested with Circles, working !

We need to edit https://apps.nextcloud.com/schema/apps/info.xsd for

	<collaboration>
		<collaborators>
			<searchPlugins>
				<searchPlugin>
					<class></class>
					<shareType></shareType>
				</searchPlugin>
			</searchPlugins>
		</collaborators>
	</collaboration>
@blizzz

This comment has been minimized.

Show comment
Hide comment
@blizzz

blizzz Sep 15, 2017

Member

@daita yup, will do it next week

Member

blizzz commented Sep 15, 2017

@daita yup, will do it next week

blizzz added some commits Sep 7, 2017

updated autoloader
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
add missing PHP doc
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
minor fixes
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
split off getUsers unit tests
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
split off getGroups unit tests
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
split off getRemote unit tests
adds two small fixes → they actually work \o/

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
split off getEmail tests
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
adjust ShareeAPIController search test
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
adjust ShareeAPIController invalid-input search unit test
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
split off former searchSharee unit test
also moves registering default plugins to Server for proper unit testing

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
adapt unit test for ensuring exception
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
move splitUserRemote unit tests
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
remove unused method
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
shareeAPIController unit test clean up and last fixes
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
add tests for Lookup Plugin
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
reduce nesting of the required app XML
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>

@blizzz blizzz referenced this pull request Sep 26, 2017

Merged

adapt info.xml #135

@blizzz

This comment has been minimized.

Show comment
Hide comment
@blizzz

blizzz Sep 26, 2017

Member

due to requests from @nickvergessen and @BernhardPosselt i simplified the required XML. OK now? Needs green lights on nextcloud/appstore#521, too.

Member

blizzz commented Sep 26, 2017

due to requests from @nickvergessen and @BernhardPosselt i simplified the required XML. OK now? Needs green lights on nextcloud/appstore#521, too.

adapt attribute name (changed letter case style)
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
@codecov-io

This comment has been minimized.

Show comment
Hide comment
@codecov-io

codecov-io Sep 27, 2017

Codecov Report

Merging #6328 into master will increase coverage by 0.03%.
The diff coverage is 69.54%.

@@             Coverage Diff              @@
##             master    #6328      +/-   ##
============================================
+ Coverage     53.06%   53.09%   +0.03%     
- Complexity    22570    22594      +24     
============================================
  Files          1417     1425       +8     
  Lines         87810    87889      +79     
  Branches       1340     1340              
============================================
+ Hits          46597    46668      +71     
- Misses        41213    41221       +8
Impacted Files Coverage Δ Complexity Δ
lib/private/legacy/app.php 53.32% <12.5%> (-0.63%) 222 <0> (+4)
lib/private/Server.php 83.47% <20%> (-0.78%) 124 <1> (+1)
lib/private/App/InfoParser.php 89.18% <25%> (-2.4%) 63 <0> (+3)
...private/Collaboration/Collaborators/MailPlugin.php 58.75% <58.75%> (ø) 19 <19> (?)
...ivate/Collaboration/Collaborators/SearchResult.php 62.96% <62.96%> (ø) 12 <12> (?)
...es_sharing/lib/Controller/ShareesAPIController.php 70% <63.63%> (+5.52%) 24 <3> (-90) ⬇️
...ivate/Collaboration/Collaborators/RemotePlugin.php 73.33% <73.33%> (ø) 17 <17> (?)
lib/private/Collaboration/Collaborators/Search.php 76.92% <76.92%> (ø) 12 <12> (?)
...ivate/Collaboration/Collaborators/LookupPlugin.php 79.31% <79.31%> (ø) 5 <5> (?)
...rivate/Collaboration/Collaborators/GroupPlugin.php 80.76% <80.76%> (ø) 16 <16> (?)
... and 16 more

codecov-io commented Sep 27, 2017

Codecov Report

Merging #6328 into master will increase coverage by 0.03%.
The diff coverage is 69.54%.

@@             Coverage Diff              @@
##             master    #6328      +/-   ##
============================================
+ Coverage     53.06%   53.09%   +0.03%     
- Complexity    22570    22594      +24     
============================================
  Files          1417     1425       +8     
  Lines         87810    87889      +79     
  Branches       1340     1340              
============================================
+ Hits          46597    46668      +71     
- Misses        41213    41221       +8
Impacted Files Coverage Δ Complexity Δ
lib/private/legacy/app.php 53.32% <12.5%> (-0.63%) 222 <0> (+4)
lib/private/Server.php 83.47% <20%> (-0.78%) 124 <1> (+1)
lib/private/App/InfoParser.php 89.18% <25%> (-2.4%) 63 <0> (+3)
...private/Collaboration/Collaborators/MailPlugin.php 58.75% <58.75%> (ø) 19 <19> (?)
...ivate/Collaboration/Collaborators/SearchResult.php 62.96% <62.96%> (ø) 12 <12> (?)
...es_sharing/lib/Controller/ShareesAPIController.php 70% <63.63%> (+5.52%) 24 <3> (-90) ⬇️
...ivate/Collaboration/Collaborators/RemotePlugin.php 73.33% <73.33%> (ø) 17 <17> (?)
lib/private/Collaboration/Collaborators/Search.php 76.92% <76.92%> (ø) 12 <12> (?)
...ivate/Collaboration/Collaborators/LookupPlugin.php 79.31% <79.31%> (ø) 5 <5> (?)
...rivate/Collaboration/Collaborators/GroupPlugin.php 80.76% <80.76%> (ø) 16 <16> (?)
... and 16 more

@blizzz blizzz referenced this pull request Oct 2, 2017

Open

Missing pieces: user mentions in Comments #2443

1 of 4 tasks complete
@blizzz

This comment has been minimized.

Show comment
Hide comment
@blizzz

blizzz Oct 4, 2017

Member

🏓

Member

blizzz commented Oct 4, 2017

🏓

@nickvergessen

This comment has been minimized.

Show comment
Hide comment
@nickvergessen

nickvergessen Oct 4, 2017

Member

Looks good and still works, but: current user is returned (was not the case before).
Maybe we can fix this before merging?

Member

nickvergessen commented Oct 4, 2017

Looks good and still works, but: current user is returned (was not the case before).
Maybe we can fix this before merging?

@nickvergessen

This comment has been minimized.

Show comment
Hide comment
@nickvergessen

nickvergessen Oct 4, 2017

Member

Okay lets do it in a follow up

Member

nickvergessen commented Oct 4, 2017

Okay lets do it in a follow up

$emailAddresses = [$emailAddresses];
}
foreach ($emailAddresses as $emailAddress) {
$exactEmailMatch = strtolower($emailAddress) === $lowerSearch;

This comment has been minimized.

@nickvergessen

nickvergessen Oct 4, 2017

Member

For me this is an empty string (when removing the email after it was set before), and therefor results in an entry admin ()
bildschirmfoto vom 2017-10-04 15-24-54

Of course this makes no sense, but we should have a look

@nickvergessen

nickvergessen Oct 4, 2017

Member

For me this is an empty string (when removing the email after it was set before), and therefor results in an entry admin ()
bildschirmfoto vom 2017-10-04 15-24-54

Of course this makes no sense, but we should have a look

This comment has been minimized.

@blizzz

blizzz Oct 4, 2017

Member

I took it over as it is from the old method and have not spotted a post processing that would remove it. Thus, it should be reproducable with the old code I think… anyhow, yes, something we should fix

@blizzz

blizzz Oct 4, 2017

Member

I took it over as it is from the old method and have not spotted a post processing that would remove it. Thus, it should be reproducable with the old code I think… anyhow, yes, something we should fix

@blizzz blizzz merged commit 2d62f97 into master Oct 4, 2017

4 checks passed

Scrutinizer 3 new issues, 48 updated code elements
Details
codecov/patch 69.54% of diff hit (target 53.06%)
Details
codecov/project 53.09% (+0.03%) compared to 271959b
Details
continuous-integration/drone/pr the build was successful
Details

@blizzz blizzz deleted the split-sharees-api-logic branch Oct 4, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment