Skip to content
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

Allow public page access to apps with group restrictions #8593

Merged
merged 3 commits into from
Mar 8, 2018

Conversation

julien-nc
Copy link
Member

This PR is related to #6962, #5309, nextcloud/polls#225 and phonetrack-oc/#78.

It allows non-logged user to access public pages of applications restricted to a group.

It does not fix the following problem : Logged-in users who are not in the authorized group cannot access public pages of an app. They are redirected to "Files" app.

I ran unit tests with autotest.sh and there were two unrelated errors :

There were 2 failures:                                                                
                                                                                      
1) Test\LargeFileHelperGetFileSizeTest::testGetFileSizeViaCurl with data set #0 ('/var/www/html/ncdev/tests/dat...em.txt', 446)
Failed asserting that null is identical to 446.                                                                      
                                                                                                                                                                             
/var/www/html/ncdev/tests/lib/LargeFileHelperGetFileSizeTest.php:53                                                      
                                                                                                                                                         
2) Test\LargeFileHelperGetFileSizeTest::testGetFileSizeViaCurl with data set #1 ('/var/www/html/ncdev/tests/dat...2).txt', 446)
Failed asserting that null is identical to 446.                                       
                                                                                                                                                                             
/var/www/html/ncdev/tests/lib/LargeFileHelperGetFileSizeTest.php:53

…loud#6962, refs nextcloud#5309

It allows non-logged user to access public pages of applications restricted to a group

Signed-off-by: Julien Veyssier <[email protected]>
@julien-nc julien-nc added the bug label Mar 1, 2018
@julien-nc julien-nc changed the title Do not throw AppNotEnabledException for app public pages Allow public page access to apps with group restrictions Mar 3, 2018
@MorrisJobke
Copy link
Member

It allows non-logged user to access public pages of applications restricted to a group.

I'm still unsure if this is the right approach, because the app could be disabled. On the other side the app code is only loaded if the app is enabled at all. Just thinking about possible side effects.

cc @rullzer @nickvergessen @blizzz

@MorrisJobke
Copy link
Member

CI failure is unrelated and fixed in master.

@rullzer
Copy link
Member

rullzer commented Mar 6, 2018

If the app is not enabled we also cna't route anywhere ;)

Let me think about this a bit. And add test cases at least. (I want all our security middleware to be properly unit tested at the very least).

@nickvergessen
Copy link
Member

Also not a big fan of this.
I get the idea, but logicwise it makes less sense to me.

@MorrisJobke
Copy link
Member

Also not a big fan of this.
I get the idea, but logicwise it makes less sense to me.

I still see the point. Sometimes you have public pages (i.e. an external API endpoint that is authenticated but you want the pages that are shown internally only show to a limited group).

@julien-nc
Copy link
Member Author

To help you picture the two problems :

I want to restrict Gallery app to a group. In Gallery, I generate a share link for a directory. For visitors who are not logged in, this link leads to a page saying : App is not enabled. For users who are not in the allowed group, there is a redirection to Files app.

In my opinion, visitors and any user should be able to visit any public page even if it comes from an app which is restricted to a group.

This problem does not exist with the File app which can't be restricted to a group.

@rullzer
Copy link
Member

rullzer commented Mar 8, 2018

Ok let me fix some tests here and then lets do it.

rullzer added 2 commits March 8, 2018 10:11
Signed-off-by: Roeland Jago Douma <[email protected]>
Signed-off-by: Roeland Jago Douma <[email protected]>
@codecov
Copy link

codecov bot commented Mar 8, 2018

Codecov Report

Merging #8593 into master will increase coverage by 0.06%.
The diff coverage is 100%.

@@             Coverage Diff              @@
##             master    #8593      +/-   ##
============================================
+ Coverage     51.87%   51.94%   +0.06%     
- Complexity    25406    25407       +1     
============================================
  Files          1609     1609              
  Lines         95296    95296              
  Branches       1378     1378              
============================================
+ Hits          49437    49500      +63     
+ Misses        45859    45796      -63
Impacted Files Coverage Δ Complexity Δ
...amework/Middleware/Security/SecurityMiddleware.php 77.38% <100%> (ø) 27 <0> (+1) ⬆️
apps/files_trashbin/lib/Trashbin.php 72.46% <0%> (-0.25%) 136% <0%> (ø)
lib/private/Files/ObjectStore/SwiftFactory.php 52.87% <0%> (+52.87%) 35% <0%> (ø) ⬇️
lib/private/Files/ObjectStore/Swift.php 75% <0%> (+75%) 8% <0%> (ø) ⬇️

Copy link
Member

@rullzer rullzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fine by me now

Copy link
Member

@MorrisJobke MorrisJobke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added code looks good and it CI failure is unrelated.

@julien-nc
Copy link
Member Author

Thanks a lot for having considered this PR !

@rullzer
Copy link
Member

rullzer commented Mar 8, 2018

@eneiluj sure. And feel free to submit more :)

@nickvergessen
Copy link
Member

Well this changes the definition of the "Enable for groups", please add to the dev notes and make sure it ends up in the release notes.

@MorrisJobke
Copy link
Member

Well this changes the definition of the "Enable for groups", please add to the dev notes and make sure it ends up in the release notes.

Yes - already on it

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

Successfully merging this pull request may close these issues.

4 participants