yadahan / nova-bouncer Goto Github PK
View Code? Open in Web Editor NEWUse the power of Bouncer within your Nova administration panel.
License: MIT License
Use the power of Bouncer within your Nova administration panel.
License: MIT License
I get this Vue error:
vendor.js?id=b9507c8034fe31843121:114495 [Vue warn]: Error in mounted hook: "TypeError: Cannot read property 'attribute' of null"
found in
---> at resources/js/views/Attach.vue
Hello, first sorry. But I don't understand how it works at all.
How can forbid a model, but let the user to edit a model id? I tried creating two abilities. One to forbid evertything in the model, and another ability to edit a model id. But not working, is always forbidden.
Thanks
Using version ^0.4.0 for yadahan/nova-bouncer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for yadahan/nova-bouncer ^0.4.0 -> satisfiable by yadahan/nova-bouncer[v0.4.0].
- yadahan/nova-bouncer v0.4.0 requires silber/bouncer v1.0.0-rc.4|v1.0.0-rc.5|v1.0.0-rc.6|v1.0.0-rc.7 -> satisfiable by silber/bouncer[v1.0.0-rc.4, v1.0.0-rc.5, v1.0.0-rc.6, v1.0.0-rc.7] but these conflict with your requirements or minimum-stability.
Installation failed, reverting ./composer.json to its original content.
I've installed nova-bouncer as per the readme in a vanilla Nova app. It crashes with
No hint path defined for [bouncer-tool]. (View: /Users/marcus/app/nova/resources/views/layout.blade.php) (View: /Users/marcus/app/nova/resources/views/layout.blade.php)
Thanks for your work!
I would like to move the abilities and roles sidebar items under my Users
group instead of the Bouncer
group. I discovered that it appears in resources/views/navigation.blade.php
as a translated item. This makes it a bit hard to get at, and subverts Nova's own $group
property that's intended for this purpose (and which is itself translatable).
Should also allow:
composer require silber/bouncer v1.0.0-rc.3
maybe (not tested):
...
"require": {
"php": "^7.1.3",
"laravel/nova": "*",
"silber/bouncer": "dev-master|v1.0.*"
},
...
Bouncer has support for extending the base Role and Ability classes, but it seems that the relationships of extended bouncer classes don't load properly.
Specifically, I am using an extended Role class and when I go to the index page for my role I don't see any of the abilities. I found that if I chance the public static $model = 'Silber\Bouncer\Database\Role'
to public static $model = 'App\Models\Role'
(my custom role class) in Yadahan\BouncerTool\Nova\Role
then the role's abilities will show up.
Maybe you could update it so that custom role/ability classes can be defined in config/bouncer-tool.php
and used as the public static $model
in Yadahan\BouncerTool\Nova\Role
and Yadahan\BouncerTool\Nova\Ability
?
If it helps, the reason the abilities don't load in my case is because the mysql query includes the WHERE clause permissions.entity_type = 'Silber\Bouncer\Database\Role'
, but none of my permissions match that entity_type since I'm using a different model.
We have the Bouncer cache permanently active. So, after we made changes to roles, abilities and permissions, we need to refresh the cache.
Is there a possibility that the cache is automatically refreshed, when we change one of the above?
I've been trying to figure out how to add a field that displays all the models that a Role
has been applied to. I know it should be roughly the inverse of the MorphToMany
used in my User
resource:
MorphToMany::make('Roles', 'roles', Role::class)->fields(
static fn() => [
Text::make('Scope')
->sortable()
->rules('nullable', 'integer'),
]
),
However, I'm failing dismally at trying to see how to define a field for "things that this Role is applied to" since obviously it doesn't have a single class name that I can give it. I can see the records in the assigned_roles
table that represent this linkage, but can't spot a corresponding relation in Bouncer to use in the MorphToMany
.
I'm hoping that you have a better understanding of this!
I've installed bouncer and then followed the instructions to install Nova-Bouncer, but still, I am not seeing it show up in the sidebar. Is there something I'm missing from the install process?
Hello, thanks for your tool! ๐
How can I create an Ability to edit/view just your own user? I'm unable to get it.
Thanks!
I'm attempting to attach a Role to a User and get the following error message:
{
"message": "SQLSTATE[42703]: Undefined column: 7 ERROR: column \"id\" does not exist\nLINE 1: ...\"role_id\", \"entity_type\") values ($1, $2, $3) returning \"id\"\n ^ (SQL: insert into \"assigned_roles\" (\"entity_id\", \"role_id\", \"entity_type\") values (14, 1, App\\User) returning \"id\")",
We don't have scopes enabled on our system, perhaps that is causing problems?
It seems the timing of the config being loaded when it's in the application's config directory is too early to use the __()
function.
You should probably move the translation work out to your other classes, closer to where and when it's needed, rather than have it happen inside the config file itself.
After attach an ability to a role I'm able to set the Forbidden check and Scope field. But once saved the resource is giving always a Forbidden in red.
Also when I want to update Forbidden is always unchecked and also scope.
Thanks!
Are there any plans to add per user ability management in a similar way to https://novapackages.com/packages/vyuldashev/nova-permission
It would be amazing to have this option!
Love what you're doing here by the way.
Thanks for the great package.
I was wondering whether there's a way to show/hide sidebar sections generated by Tools based on roles or abilities?
As an example, I use Nova Log Viewer on a CMS and only want users with the System Administrator role be able to manage logs.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.