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

Disable calls from modules to DB / Auth for 3rd party developers #792

Closed
stefnats opened this issue Jul 9, 2019 · 5 comments

Comments

Projects
None yet
2 participants
@stefnats
Copy link

commented Jul 9, 2019

Hi,

i want to enable third party developers to extend our web app via laravel-modules.
However, i don't want them to access the raw user data, so to disallow something like

User::all()

or

DB::table('users')->query()->get()

or even

auth()->user() or Auth::user()

Is this possible using this package or do you recommend using other approaches?

@nWidart

This comment has been minimized.

Copy link
Owner

commented Jul 9, 2019

Hi,

This is not in the scope of this package, probably any package as it's custom stuff.
I suggest you make your own wrapper classes around User DB etc, where you check for roles/permissions before proxying through the main class.

@stefnats

This comment has been minimized.

Copy link
Author

commented Jul 9, 2019

You're right, that's a good idea.
Do you know which would be the easiest way to, let's say, change the DB::table('users')->query()->get() method (just the get) without screwing with the laravel code managed by composer?

@nWidart

This comment has been minimized.

Copy link
Owner

commented Jul 9, 2019

I didn't mean you have to change laravel's code. I meant you create your own wrapper class which proxies calls through laravel's class.

Something to look up, the decorator pattern.

@stefnats

This comment has been minimized.

Copy link
Author

commented Jul 9, 2019

Thanks, Nicolas!

@nWidart

This comment has been minimized.

Copy link
Owner

commented Jul 19, 2019

I'll close this as there hasn't been a reply in a while, feel free to comment if needed.

@nWidart nWidart closed this Jul 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.