question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`default_access_fn` always returns True for forked apps

See original GitHub issue

Issue Summary

I’ve managed to reproduce this for any dashboard app and will use the Pages dashboard app as the example in this ticket.

I’ve narrowed the issue down to apps.get_containing_app_config returning Shop when it should return PagesDashboardConfig. https://github.com/django-oscar/django-oscar/blob/fe983bf7140457d06094d843da0b94ebaea4d6c8/src/oscar/apps/dashboard/nav.py#L98

I’ve tried changing the check on line 99 to

if app_config_instance is None or not isinstance(app_config_instance, OscarDashboardConfig):

But then, get_app_config_class will return the base OscarDashboardConfig class which is also not what we want.

Steps to Reproduce

  1. Fork the Pages dashboard app ./manage.py oscar_fork_app pages_dashboard . oscar_forks.dashboard.pages
  2. Log into the dashboard with a user with partner.dashboard_access
  3. Notice the Content submenu is visible while the whole Pages app has this default permission https://github.com/django-oscar/django-oscar/blob/fe983bf7140457d06094d843da0b94ebaea4d6c8/src/oscar/apps/dashboard/pages/apps.py#L13

Technical details

  • Python version: 3.7.4
  • Django version: 2.2.3
  • Oscar version: 2.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
rikcommented, Jul 22, 2019

Here’s my PRs plan:

0reactions
solarissmokecommented, Jul 21, 2019

We have a bunch of forked apps in the _site project that is used for tests. One approach is to fork one of the dashboard apps into there, and then have integration tests that check that the forked app’s config is being used to determine permissions.

This approach is not particularly pretty because the forking applies for the entire test suite, but we haven’t found a better alternative.

This would ideally be in addition to unit tests for _dashboard_urls_to_config() for which get_app_configs() can be mocked.

Read more comments on GitHub >

github_iconTop Results From Across the Web

os — Miscellaneous operating system interfaces — Python ...
Return the value of the environment variable key as a string if it exists, or default if it doesn't. key is a string....
Read more >
The fork() System Call
System call fork() is used to create processes. It takes no arguments and returns a process ID. The purpose of fork() is to...
Read more >
Set the default form that appears when you open an Access ...
Specify the default form in Access Options · Click the File tab, and then under Help, click Options. · Click Current Database. ·...
Read more >
Maven Surefire Plugin – Fork Options and Parallel Test ...
Using reuseForks=true (by default) and forking the test classes in reusable JVMs may lead to the same problem with shared static code across...
Read more >
Why do we need to fork to create new processes?
While both points are true, neither supports why forking method was chosen instead of reating a new process from given executable. – hellodanylo....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found