meeting-room-booking-system / mrbs-code

MRBS application code
Other
121 stars 59 forks source link

More flexible theming system #17

Open dorianim opened 3 years ago

dorianim commented 3 years ago

Is your feature request related to a problem? Please describe. I tried to create a bootstrap theme for MRBS but was unable to find a clean way to override the integrated html templates.

Describe the solution you'd like An option to override integrated html templates in themes would be great. Maybe similar to how custom authentication can be implemented.

Describe alternatives you've considered I worked around this problem by injecting JavaScript in the header.inc which modifies the html on client-side.

Additional context My theme can be found here: https://github.com/dorianim/modern-mrbs-theme/

And this is the Js which patches the html: https://github.com/dorianim/modern-mrbs-theme/blob/main/modern/patch.js

It works well enough, but I really hate the implementation. Would be nice to have a clean way to do this :)

being-peace commented 2 years ago

@dorianim Do you have an idea / a patch, how this could be implemented?

dorianim commented 2 years ago

Hi @being-peace I think it should be implemented similarly to how one can implement a custom authentication handler: https://github.com/meeting-room-booking-system/mrbs-web/blob/753c2b6f1a53a96f16cdcf1d6726385bbaa68d32/AUTHENTICATION#L999

But it has to be way more extensive. This is probaply not an easy task, though. Most html is generated over here: https://github.com/meeting-room-booking-system/mrbs-code/tree/main/web/lib/MRBS In order to achieve real theme capabilities, it would be necesarry to override all of these classes where html is generated. The use of jqueryui is also problematic, as it conflicts with bootstrap in some places. I would use vue.js instead of jqueryui for that purpose. So this would also have to be handled by the theme.

To make it short: this is a sophisticated task and I neither have the time nor the knowledge of the mrbs source code to do this myself.

dorianim commented 2 years ago

@jberanek @campbell-m have you ever considered using a framework like laravel? It has become the defacto standard for bigger php projects in the last years and there are a ton of applications using it. It would make things like this a lot easier.

campbell-m commented 2 years ago

I like your theme and I think we should probably move to something like Laravel or Bootstrap. However before we embark on what would be quite a big upheaval I'd like to get the work on the roles branch finished and reintegrated with main, so that we are back to having a single active branch. The roles branch is quite a major change and I think it would be too complicated having three very different branches.

dorianim commented 2 years ago

I understand that. Laravel comes with a lot of features out of the box, by the way. User authentication and also role base authorization is already included in a very nice way: https://laravel.com/docs/8.x/authentication :)

being-peace commented 2 years ago

@campbell-m Mentioning the "roles branch": Is there some documentation what is going to be achieved there? Reason why I ask: I am working on a patch to separate rights of is_booking_admin and may_edit_and_view_all_bookings, because I would like to configure for a cooperative environment, where non-admins may change other peoples bookings. And I would like to know, if there may be conflicts or if this superseded by the roles branch.

campbell-m commented 2 years ago

Yes, the roles branch will supersede it (and conflict with it). No documentation yet, but it introduces the concepts of groups and roles. You will be able to define roles which you can assign to users and/or groups. Each role consists of a set of permissions, which are defined for individual rooms and areas. For each room/area you can grant or deny read, write or admin rights. The code is pretty much working for the LDAP authentication type. I still need to do some work for the other types.

being-peace commented 2 years ago

This sounds great! So I could give "non-admins" (non-admin booking types) the right to change other peoples bookings? Do you have an idea, when it might be finished? This year? Then I would stop working on my patch. :-) Is there something I could help? E.g. non LDAP testing when this is ready?

[Sorry for the offtopic here, but I don´t know, where to ask those questions in a more appropriate way]

campbell-m commented 2 years ago

Yes, ordinary users will have rights to change other people's bookings if they have been given admin access for that room. That's all they'll be able to do though: they won't be able to create users or rooms or anything like that.

Not sure when it will be finished. Probably early next year. I'd certainly appreciate some testing help.

being-peace commented 2 years ago

@campbell-m Feel free, to contact me. Do you also need some coding support? (Not sure, if I can help with respect to competences and availability.)