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

Accessing General settings form Admin settings does not display disabled submenus #2958

Closed
jsoppela opened this issue Mar 22, 2019 · 4 comments · Fixed by #2960
Closed

Accessing General settings form Admin settings does not display disabled submenus #2958

jsoppela opened this issue Mar 22, 2019 · 4 comments · Fixed by #2960
Assignees

Comments

@jsoppela
Copy link

Software and hardware versions

Collect v1.20.0, Android v9 build number 00WW_5_140, device used Nokia 8 TA-1004

Problem description

Accessing General settings from Admin settings does not display all General settings submenus if access to them has been revoked from normal users.

When normal user access for all settings has been disabled, only the following submenu items are available in admin mode:

  1. Server Settings -> ODK Aggregate settings
  2. Form management -> Form filling -> Show guidance for questions

Steps to reproduce the problem

  1. In Admin Settings -> User Settings, uncheck all check boxes
  2. Check available settings in Admin Settings -> General Settings -> Server
  3. Check available settings in Admin Settings -> General Settings -> User interface
  4. Check available settings in Admin Settings -> General Settings -> Form management
  5. Check available settings in Admin Settings -> General Settings -> User and device identity

Expected behavior

Accessing General settings via the Admin settings should allow access to all the settings in General settings submenus.

Other information

Class org.odk.collect.android.preferences.DisabledPreferencesRemover does not seem to take into account whether the user is in admin mode or not.

Class org.odk.collect.android.preferences.GeneralPreferencesFragment handles admin mode correctly for main General settings categories.

@ajwad-shaikh
Copy link
Contributor

@opendatakit-bot claim

@jsoppela
Copy link
Author

I'm working on a slightly diverged Collect fork where this issue is solved by handing the boolean variable indicating admin access down to the submenu fragments. I've added the following lines here:

Bundle bundle = new Bundle();
bundle.putBoolean(INTENT_KEY_ADMIN_MODE, getArguments().getBoolean(INTENT_KEY_ADMIN_MODE));
fragment.setArguments(bundle);

Without this change the submenu fragments are always called without arguments including admin mode by this method call.

Please feel free to use this approach @ajwad-shaikh unless you've already found another solution.

@ajwad-shaikh
Copy link
Contributor

I've found a very similar solution. I'm sending out a PR soon.
Thank you for taking out time to help @jsoppela
I'll be glad if you would review the PR too 😄

@ajwad-shaikh
Copy link
Contributor

@lognaturel @shobhitagarwal1612 This is an important issue raised by @jsoppela
Admins were unable to access the restricted settings to normal users. This creates a vulnerability in the workflow. Request you to put this up within the v1.21 milestone.
Would be glad if one of you could take time out to review this PR

@shobhitagarwal1612 shobhitagarwal1612 added this to the v1.21 milestone Mar 22, 2019
@grzesiek2010 grzesiek2010 removed this from the v1.21 milestone Mar 25, 2019
grzesiek2010 pushed a commit that referenced this issue Mar 26, 2019
* Added constructor to preferences menu fragments

* Fixed WhitespaceAround checkstyle violations

* Fixed redundant code

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

Successfully merging a pull request may close this issue.

5 participants