Role Assignments

Role Assignments

by scott braithwaite -
Number of replies: 4

Hi I have a situation caused in large by ignorance, on our moodle we have different user roles which we use to split of users for different tasks this works brilliantly and with our custom code and has done for a while, however I have just discovered a floor with this as our custom users are clones of the manager, however I have noticed that I have problems with this and after researching have found the following:

1 - The roles are using system context

2 - All users with these roles show on all courses

3. That I should be running queries against the context but not the roles.

I need these roles to be set up for specific categories, or specific groups, so how would I do this using the context so that I am doing this the right way rather than the wrong way.  I need to also stop these users showing up in all course enrolled lists when printing off scorm reports for the courses.


So can anyone point me towards doing this the correct way rather than the incorrect way.


Thanks


Scott

Average of ratings: -
In reply to scott braithwaite

Re: Role Assignments

by Colin Fraser -
Picture of Documentation writers Picture of Testers

Wow, talk about a mess.... but you have largely answered your own question. you say: 

roles to be set up for specific categories, or specific groups,


You can assign to roles in specific categories on the Category page. Just go to the Category Page and from the Administration menu, assign Roles, the Role has an affect on all courses in that Category, but nowhere else. As far as group Roles... mm I do not think there is a way of assigning a Role to any one group or grouping - well not that I have found anyway. There may be a Group Role plugin but you are going to have to look for it in Plugins, but I do not think there is. Roles are individual and selective, whereas group roles are generic and I suggest are likely to open a number of security holes.   

Documentation for Roles can be found on these pages. Essentially, Roles have not changed since v2.0, from memory, so the docs will be reasonably accurate in detail as well as overall.  

In reply to Colin Fraser

Re: Role Assignments

by scott braithwaite -

Hi thanks Colin will look at the documentation.  Sorry but need to give some clarification groups/categories are categories just they get referred to as both in the office,  Also the issue I have is that an advanced user or manager can make someone a manager or advanced user for the group they are in or revoke the privileges, so say you had group a, group b, and 2 sub groups of group a 1 and 2 I need when this group is created for the privileges to be inherited by the sub groups.  However I need this to also be removable if an advanced user removes someones manager privileges from a group or sub group.


At present this works with the custom code but as I said realized there are going to be significant problems with Moodle so trying to fix this now,  But this will need to be able to use code which is dynamic across all categories but setting the privileges to just the category the user is adv user or manager for on the Moodle side as well as the custom side.


Hope this gives a bit more information about the problem but thanks again Colin good place to start.

In reply to scott braithwaite

Re: Role Assignments

by Colin Fraser -
Picture of Documentation writers Picture of Testers

Hi Scott, for some reason I was being blocked here, on this forum, but as someone pointed out I was using double quote marks, take them out and try again. This should have been posted yesterday morning, my time. 


That seems to me to be a fairly complicated way of doing things actually, there has to be a way of streamlining the process. The more custom code you toss into Moodle the more likelihood of significant error. What may have started out as a logical and reasonable process, can easily become spaghetti. 

I seriously suggest you revisit the concepts of Roles as applied in your Moodle. You mention Managers and advanced users and changing privileges, not necessarily a good idea to have so many people who can change other's Roles. 

Be very clear in your distinctions between User Roles, and make sure the capabilities are set to accommodate your need. And here is where I have a conceptual problem, trying to understand why Roles would have such a need to be so varied. Is this a reward/punishment idea? Could badges be a more viable alternative? Keep Roles standardized but offer recognition for potential mentors sort of thing?  


In reply to Colin Fraser

Re: Role Assignments

by scott braithwaite -

Hi colin 

The idea behind this is that different groups will be managed by different people but these people will also have access to some groups that they do not manage.


The product which have produced was to meet a specific goal and we had to provide categories where courses could sit, this is also using a custom layout, within each category would sit an advanced section which could not be accessed by students, the advanced user manager needs to access this however and they need specific privileges to different custom mods within this area, through the custom code (none of which is effecting core) they can then carry out the tasks needed.  Another part of the requirements for the site was to have blocks removed so the menu structure is not available for these users.  Each group would be managed by its own advanced user and designated managers. however the adv user needs to be able to make users managers or remove the role of manager from a user.


So the new roles worked for allowing the custom elements to restrict the users to the site.   However I took over working on this fresh to Moodle and after 15 months working on coding moodle I have come to realise that we have some poor practices implemented.  One we use roles instead of capabilities 2 we do not utilise as much of moodles functionality as we should be. 


So can this be done without ruining the moodle functionality and what is the best way to do this due to the need for dynamic code across the groups. 


As I said it works well for our custom elements of the site but I have notice only one problem at present that can cause us significant problems when an advanced user in one group but a student in another group can still see hidden elements of the course and potentially edit courses in different groups.


Hope this makes more sense as it is difficult to put the concept across in words.  My end goal here is to get this working but to try to utilise Moodle effectively at the same time.


Thanks in Advance


Scott