Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Giving a user multiple roles?

edited September 2006 in Vanilla 1.0 Help
Is it possible to give a user multiple roles? I couldn't seem to find a way to do this, but perhaps I've missed something. If not, are there are add-ons available to allow this? (I searched, but couldn't find anything). Put simply, I'd like to have one role allowed access to category A, and another allowed access to category B. I'd then like a third group of people allowed access to both categories, without having to create a third role that explicitly allows access to both (instead, those people could be members of both roles). It may not seem like much effort to create a third group, but when you multiply a similar situation out over many groups and categories, it quickly becomes a headache when users can only have one role at a time. Thanks.
«1

Comments

  • You are lucky, this add-on is still available for development...
  • joefish: I'm glad there is another supporter for this idea, I've been wanting a better permissions system for ages!
  • I'm not using Vanilla on the site I run yet - as this feature is absolutely necessary. The whole site (and more importantly, the non-public apps for staff members of our organisation) will be built around this ability. I haven't looked at any of the Vanilla code yet, although I might have a tinker round and see how this could be implemented. If anyone else has done or knows of any work towards this, I would be very grateful.
  • Lot of people have ask for it. Someone wanted to work on it, but I don't know if she made any progress with it: http://lussumo.com/community/discussion/3148/requests-or-development-adviceassistance/#Item_27
  • I would also like to see this add-on. It would open the possibility to use categories as subforums. Probably this is not what Vanilla was intended for, but it could help in some situations. For example it would allow some users to manage a specific category as administrators to help in mantaining the site. I have also found this need using Vanilla for a students forum, where each category is associated with a different course. Different students are in a different set of courses, and the proffesor of each course should have administrator permissions in the corresponding category.
  • edited August 2006
    This is very similar (at least in part) to what I want to do, Arturo. The forum I manage is also for students, in my case I have different categories for students from different university campuses. With phpBB, I have groups set up for students from each campus, and then a group each for the staff from the different campuses. This way I can assign different permissions to each group (such as the categories they can see and post in). There is also a category for all staff, and a category for all students. Then there are areas for only certain staff.... and as you see it gets complicated fairly quickly. I've taken a (brief) look at some of the code for Vanilla. As Mark has said - almost anything is possible with an extension - however, it seems that it may be extremely inefficient to do it that way, with the way that the classes are currently designed (in assuming that a person can only have one role). Of course, I may be wrong (and would hope that I am).
  • @Arturo: your post made me realise this extension can solve problems I had thought of solving in other, more complex ways. I use my forum for non-profit planning of a 23000 person scout camp (!). There are lots of groups and sections of people who work on different aspects of the camp, but often they need to collaborate in unexpected ways.

    I had planned to set up a system of Vanilla boards which shared the same user base. However, with multiple roles per user I think I could achieve the same effect in one forum! Would save tonnes of work (I'd have to set up ~15 boards otherwise). Additionally, people could use the block/unblock category feature to keep track of discussions in other user groups' categories.

    The only issue would be to integrate the multiple-role feature with the (coming) Attachments 2.0 extension to allow for more premissions options also there.
  • Indeed, this could interfere with some extensions (e.g. Role History ;-) Any extension dealing with permissions on itself could be affected. But for the main forum functions it should be possible to do it cleanly. What really worries me more is what are the plans of Mark about categories in general. I remember to read something about that and it was about important changes in the future.
  • I've asked Mark if he would be able to comment on this thread, in terms of any future plans for roles/permissions etc. This could help us in terms of planning any extensions or modifications etc. Hopefully we can find a viable option.
  • MarkMark Vanilla Staff
    I hadn't thought of this at all to tell you the truth. I've personally never needed anything more complex than already exists with Vanilla.

    That being said, it's not completely out of the question to do this type of thing. You would, of course, need a junction table between roles and users. Keep in mind that the role permissions are loaded on every page load, so you'd want to spend some time altering that query to make it faster. This can be done through delegation without too much hassle. Basically you'd also need to do some work with the permission arrays - any true values override false ones.

    Finally, you'd need to redo role-change form. I believe it's not included in the page until it is instantiated by the object factory, so you should be able to just write your own version and include it in the page in your extension file. That way it is already declared and the existing one won't be loaded.

    Theoretically that's all you'd have to do.
  • **eagerly awaits on of the many Vanilla pros! **
  • Ok, I need this as well!! I just came accross this issue last week on my own WOW forum!! I'll guess I'll be going to look into it :)
  • It'll be done in a week at the most.
  • @nathan: WOOHOO! :) - I can't wait!!!
  • I look forward to seeing what you come up with. (Tempted to have a go myself, but time constraints don't allow it). Will be happy to help bug-test etc.
  • @nathan: I'm seriously thinking about prining an orange pig's head onto an A2 poster and slapping it on the wall!
  • Any progress nathan?
  • Well, he never sais *he* would do it ;-) Anyway, when it is possible to give a user multiple roles I will immediately throw away phpbb. As icouto said: "I can't wait!!"
  • I'm already done... just have to finish the form so you can save the roles to user accounts :)

    One thing though: it has to be the first extension which should be loaded because the roles have to be determined before other extensions are triggered. As you can not select the order in which extensions should be loaded, you'll have to manually edit the conf/extensions.php file.

    Also, I'm thinking of re-doing the roles & permissions list and sort them into different tabs or something... But maybe for a next version :) Once the form is done, I'll release the multi-roles extension :)
  • For the record jazz, you could *really* easily hack my panel re-order extension to make something so users can define the order in which extensions are loaded.
This discussion has been closed.