- 
        Couldn't load subscription status. 
- Fork 4
#5 improve user role and site management #8
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
base: main
Are you sure you want to change the base?
#5 improve user role and site management #8
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks mostly done 🙂
But I found some problems in the logic. So apart from these changes, I will add a comment in the PR for further changes.
| test('new user automatically gets panel_user role', function () { | ||
|  | ||
| }); | ||
|  | ||
| test('user from seeder gets panel_user role', function () { | ||
|  | ||
| }); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests are empty?
| @thapacodes4u what about number 4? What do you suggest? Edit: I see error from number 3 is still present. | 
| 
 I am not fully done yet still working on some of the things. By the way I am not getting that error when I create new role with some site being selected. (Ignore the site id in the view its not fixed yet) Screen.Recording.2025-06-13.at.6.39.00.PM.mov | 
| 
 As for number 4. I am working on it. I think its better to just create a new function called  | 
| Ah ok, sorry, I thought you were done 🙂 | 
| @SlimDeluxe By the way I am getting this weird issue related to  But I couldn't run  | 
| Don't worry about the health plugin problem, just commit whatever you have and I'll look into it. | 
| I see a new commit, but it doesn't affect the hasRole / hasRoleGlobally methods, as we talked yesterday. I guess you are still working on that? | 
| I am working on it I will push that soon I tried few approach so it's
taking little time. Other then that I created a PR for random password
generator that was quick one so you can check that out as well… On Tue, Jun 17, 2025, 12:34 PM Omer Sabic ***@***.***> wrote:
 *SlimDeluxe* left a comment (DataLinx/eclipsephp-core#8)
 <#8 (comment)>
 I see a new commit, but it doesn't affect the hasRole / hasRoleGlobally
 methods, as we talked yesterday. I guess you are still working on that?
 —
 Reply to this email directly, view it on GitHub
 <#8 (comment)>,
 or unsubscribe
 <https://github.com/notifications/unsubscribe-auth/ASFRQEXKMBCENFPD44ONN2T3D6263AVCNFSM6AAAAAB7EYJZE6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSNZZGE2DMNJTGM>
 .
 You are receiving this because you were mentioned.Message ID:
 ***@***.***>
 | 
| And by the way I removed the site selection in create / edit user now that
happens automatically like we discussed in meeting
On Tue, Jun 17, 2025, 12:37 PM Ankit Thapa ***@***.***>
wrote:…  I am working on it I will push that soon I tried few approach so it's
 taking little time. Other then that I created a PR for random password
 generator that was quick one so you can check that out as well
 On Tue, Jun 17, 2025, 12:34 PM Omer Sabic ***@***.***>
 wrote:
> *SlimDeluxe* left a comment (DataLinx/eclipsephp-core#8)
> <#8 (comment)>
>
> I see a new commit, but it doesn't affect the hasRole / hasRoleGlobally
> methods, as we talked yesterday. I guess you are still working on that?
>
> —
> Reply to this email directly, view it on GitHub
> <#8 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ASFRQEXKMBCENFPD44ONN2T3D6263AVCNFSM6AAAAAB7EYJZE6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSNZZGE2DMNJTGM>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
 | 
| Ok, no problem. We are building a long-term product and this needs to be done the best way possible :) | 
| @thapacodes4u actually I found out that hasRole does not work with site roles, only global. test('user is correctly given site role', function () {
    $site = Site::factory()->create();
    $siteRole = Role::create(['name' => 'site_admin', 'guard_name' => 'web', 'site_id' => $site->id]);
    $user = User::factory()->create();
    $user->assignRole($siteRole);
    $this->actingAs($user);
    Filament::setTenant($site);
    expect($user->hasRole('site_admin'))->toBeTrue();
});But hold for now, don't fix anything, let me rethink this... I think we can make it better. | 
| @SlimDeluxe sure let me know if you want me to further work on this. I am currently working on different PR ( #10 ) | 
| @SlimDeluxe Sure I am about to be done with #10 . Maybe by tomorrow morning or evening and then I will jump into this. This looks straight forward. I will let you know if I find any part confusing. | 
…ataLinx#5-improve-user-role-and-site-management
| @SlimDeluxe I found a core issue with the unified role approach we discussed. When a user has the same role (e.g., "Admin") assigned both globally AND to a specific site, the UI becomes confusing and data gets corrupted: 
 What happens: Suggested fix: site_id = null → Global role This way "Admin" can exist in both contexts without data conflicts, and the form sections won't overwrite each other. Spent time trying to make the current approach work, but it requires hacky workarounds. The site_id distinction would be much more robust. Heres a screenshot (I haven't pushed this because its not a working solution As I have mention above I tried for a while to get this working with a unified role approach it doesn't look like we can do it this way)   | 
| 
 Maybe we can discuss about this in todays meeting | 
| @SlimDeluxe The role and permission in user create/edit is not completed yet there is still weird bug on it. I add is_global field and using that as identifier between role assigned by global role section and site role section. | 
| Codecov Report❌ Patch coverage is  
 Additional details and impacted files@@             Coverage Diff              @@
##               main       #8      +/-   ##
============================================
+ Coverage     73.10%   73.52%   +0.41%     
- Complexity      289      334      +45     
============================================
  Files            54       56       +2     
  Lines          1848     2115     +267     
============================================
+ Hits           1351     1555     +204     
- Misses          497      560      +63     ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
 | 






What was done in this PR?
Role create/edit:
site_idcolumn inrolestable. So add a site field inCreate&Edituser page were user can select. (Completed)User create/edit/view:
GlobalorSite-specificrole in the dropdownsite_has_usertable should also be updated. (Completed)Access Informationthat basically provide info about what site they have access to and what roles they have.User control:
Site management:
site_idis null. So anyone having this role should have access to any new site that gets created.User list:
Some Preview