-
Notifications
You must be signed in to change notification settings - Fork 53
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
Update Readme to help out new folk #8
Comments
I need to know how to do this. I cannot use this package if its webpage will be public. |
Hi, I've been very busy for the past few weeks, I will try to improve the documentation now. I don't recommend leaving the cron configuration in public mode, but if you wish you can simply return true to your gate. Gate::define('viewDatabaseSchedule', function ($user) {
return true;
}); I will add a little more documentation. Thank you for your interest. |
Thank you for your reply. I see you provide a gate in called If I add another gate with the same name then will the gate I add override your gate? Or will they conflict with each other in some way? |
As long as you register your gate after this one, yours will override. So if you put it in your App Service Provider*, you're good 👍 |
Thank you. I've just tried this, returning false in the gate definition, and I can still access the webpage (/schedule). This is the contents of <?php
namespace App\Providers;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Gate::define('viewDatabaseSchedule', function ($user) {
return false;//$user->hasRole('Administrator');
});
}
} And now I think about it, the default gate provided by the package should have denied access before I added my overriding gate above, but it let me access the webpage. The default gate is: Gate::define('viewDatabaseSchedule', function ($user) {
return in_array($user->email, [
//
]);
}); So either I'm doing something wrong (likely) or the access control doesn't work. |
I think the gate is only checked if you're not on a local environment
…On Mon, Apr 12, 2021, 14:10 cja ***@***.***> wrote:
Thank you. I've just tried this, returning false in the gate definition,
and I can still access the webpage (/schedule).
This is the contents of app/Providers/AppServiceProvider.php:
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Gate;use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/** * Register any application services. * * @return void */
public function register()
{
//
}
/** * Bootstrap any application services. * * @return void */
public function boot()
{
Gate::define('viewDatabaseSchedule', function ($user) {
return false;//$user->hasRole('Administrator');
});
}
}
And now I think about it, the default gate provided by the package should
have denied access before I added my overriding gate above, but it let me
access the webpage. The default gate is:
Gate::define('viewDatabaseSchedule', function ($user) {
return in_array($user->email, [
//
]);
});
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#8 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABDFRQMYB2R2PRWA5ZBECXTTILPNHANCNFSM4Z7WJ6LQ>
.
|
Do you mean that if I change I just did that then ran Hopefully I did the wrong thing... |
I have improved the documentation a little, but after that I saw that the @cja-github question has not yet been answered, I am doing some more tests and I will update again, give me a few minutes to do so. |
I added a configuration to make the route public and left the gate by default false, so it is mandatory to inform a gate if the route is not public. Thank you for your contribution @cja-github @JohnRoux I will close this issue, but if they still find any problem they can reopen. |
Thank you very much. |
Hey,
It would be great if you could add an example of how to modify the gate in the
Dashboard Authorization
sectionIt's a crucial part of the install and not all users will be familiar with extending vendor Service Providers 👍
The text was updated successfully, but these errors were encountered: