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 subadmins to read app config values #40961

Merged
merged 5 commits into from Sep 25, 2023
Merged

Conversation

jvillafanez
Copy link
Member

Description

Create a new AppConfigController aiming to deprecate the old "core/ajax/apppconfig.php" file. The functions in the "core/js/config.js" file will use the new controller.

Some additional notes:

  • Parameters for the GET requests ("getApps", "getKeys", "getValue" and "hasKey") will be sent as part of the url, so they're be visible to anyone
  • Parameters for PUT and DELETE requests ("setValue", "deleteKey" and "deleteApp") can be sent both in the url or in the body
  • For now, only the parameters of the "setValue" will be sent in the body

In addition, the "getApps", "getKeys" and "getValue" will be available to subadmins ("hasKey" will rely on the "getValue" method in the server, so it will also be available)

Related Issue

https://github.com/owncloud/enterprise/issues/5981

Motivation and Context

Some of the functionality wasn't working for subadmins because they couldn't read the app config.

How Has This Been Tested?

  • test environment:
  • test case 1:
  • test case 2:
  • ...

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:
  • Changelog item, see TEMPLATE

@update-docs
Copy link

update-docs bot commented Aug 31, 2023

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@steelcuts
Copy link
Contributor

Which apps are utilizing this functionality, or how can I obtain this information?

@jvillafanez
Copy link
Member Author

@phil-davis the errors in the acceptance tests in https://drone.owncloud.com/owncloud/core/39004/136/18 are expected, aren't they? We need to adjust the tests. I mean, the code is fine but the tests aren't valid any longer with the new code.

@jvillafanez
Copy link
Member Author

Which apps are utilizing this functionality, or how can I obtain this information?

Grepping by OC.AppConfig might be the easiest option. Any matching js file might need to be checked.

@jnweiger
Copy link
Contributor

jnweiger commented Aug 31, 2023

I don't want to include this in 10.13.1 -- branching the release branch now, before this gets merged.
(If we should decide differently, then redirect to release-10.13.1)

jnweiger added a commit that referenced this pull request Aug 31, 2023
branched from master,
 - taking 5 small well understood easily testable fixes (for php8 forward compatibility)
 - but before #40961 gets merged to master.
@phil-davis
Copy link
Contributor

@phil-davis the errors in the acceptance tests in https://drone.owncloud.com/owncloud/core/39004/136/18 are expected, aren't they? We need to adjust the tests. I mean, the code is fine but the tests aren't valid any longer with the new code.

Yes, if the requirements have changed (or are now understood differently) then we need to adjust the tests.
I can sort that out tomorrow, if that is OK. Or you can change it.

@jvillafanez
Copy link
Member Author

I'll leave it up to you. Feel free to add your commits here.

@phil-davis
Copy link
Contributor

acceptance tests have passed
SonarCloud is complaining - but probably there is not much that can be done for unit test coverage of the code here?

jnweiger added a commit that referenced this pull request Sep 11, 2023
* prepare 10.13.1
branched from master,
 - taking 5 small well understood easily testable fixes (for php8 forward compatibility)
 - but before #40961 gets merged to master.

* Improve images (#40963)

* Revamped the onlyoffice.png in gimp: cleaner and smaller PNG, ugly checkerboard background removed. (It was actually a 200k jpeg)
Replaced wopi.png with the logo found at github.com/OfficeDev/PnP-WOPI (it was a copy of the onlyoffic jpeg)

* added transparent round corners to the new icons.
drawio.png and richdocuments.png already have transparency.

* fix: disallow pre-signed url access if the signing key is not initialized

* bump Changelog

* bump version.php for final

* prepare merge back.

* prepare merge back, using 10.13.2 prealpha ...

---------

Co-authored-by: Juergen Weigert <jnweiger@gmail.com>
Co-authored-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
@voroyam
Copy link
Contributor

voroyam commented Sep 15, 2023

what is the status of this?

@pako81 pako81 requested a review from mrow4a September 19, 2023 15:43
@pako81
Copy link
Contributor

pako81 commented Sep 19, 2023

@IljaN @steelcuts @mrow4a can you please review this?

Copy link
Member

@IljaN IljaN left a comment

Choose a reason for hiding this comment

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

LGTM. Please add changelog.

@jvillafanez
Copy link
Member Author

Changelog added

}

/**
* @NoAdminRequired
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: there is also a NoSubadminRequired annotation which allows a method to be used even if the user is not a subadmin.

So with just the NoAdminRequired annotation, this method can be used by admins and subadmins, which is what we want. Ordinary users, and "the public" won't be able to use the method.

@pako81
Copy link
Contributor

pako81 commented Sep 25, 2023

SonarCloud is complaining. CI is passing. Should we merge this?

@phil-davis
Copy link
Contributor

@jvillafanez
Copy link
Member Author

Unit tests added

Copy link
Contributor

@phil-davis phil-davis left a comment

Choose a reason for hiding this comment

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

LGTM if tests pass.

@sonarcloud
Copy link

sonarcloud bot commented Sep 25, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

60.4% 60.4% Coverage
0.0% 0.0% Duplication

@pako81
Copy link
Contributor

pako81 commented Sep 25, 2023

CI is green..merging.

@pako81 pako81 merged commit 500c505 into master Sep 25, 2023
3 checks passed
@delete-merged-branch delete-merged-branch bot deleted the fix_subadmin_appconfig branch September 25, 2023 11:54
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.

None yet

7 participants