Permission to a user

Re: Permission to a user

by Helen Foster -
Number of replies: 2
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

You would need to assign the role to the user, however you would only need to create the one new role, not 50.

Also, depending on what exactly you want to achieve, you may be able to save a bit of effort by assigning the role in the course, category or system context.

In reply to Helen Foster

Re: Permission to a user

by Jack Eapen -

Hi Helen,

sorry for being dumb sad

My thinking that I need 50 roles is like this-Jack, John, Jill and Mary are in student role. I want Jack to view an HTML block, but don't want John to view it. So I need to create a role view_html and assign the role to Jack. Now I want John to view "Online Users" block, but don't want Jack to view it. So I cannot give "allow" permission for "View Online Users Block" in the "view_html" role, because if I give it, then Jack would be able to view the "Online Users" block. So I guess I need to create another role "view_online_users" and assign to John, and so on....

Is my understanding correct?

In reply to Jack Eapen

Re: Permission to a user

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Jack,

No need to be sorry for not understanding. Roles and permissions are definitely not easy to understand!

You only need to create one role (as described in my previous post) then assign it as follows:

  1. Turn editing on in the course then click the edit cog for the HTML block and select 'Assign roles in HTML block'

  2. Assign the block viewer role to Jack

  1. In the administration block, follow the permissions link

  2. Remove Authenticated user, Guest and Student as roles with permission to view the block

Then only Jack will be able to view the HTML block.

Do the same for the Online users block. The block viewer role will be available for you to assign to John. Because you are assigning the role in the block context, it only applies to the block.

Hopefully you can follow these steps. Please shout if anything is unclear.