Testing for role in an individual script

Testing for role in an individual script

by Justin Wyllie -
Number of replies: 2

Hi

I'm new to Moodle and just getting my head round the roles and capabilities system. I think I've got the rough idea how I can define allowed usage of a module in the access file but my case is that within a module I want to be able to detect the role of the current user and allow access to that one script or nor depending on the role.

How would I do this?

Thanks.

 

 

Average of ratings: -
In reply to Justin Wyllie

RESOLVED: Testing for role in an individual script

by Justin Wyllie -

Ok. I see. You create your own capability and test for that.

In reply to Justin Wyllie

Re: RESOLVED: Testing for role in an individual script

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Yes. Well done for working that out so quickly.