Adding custom capabilities

Adding custom capabilities

by Donnie Hedin -
Number of replies: 7
Hi, I'm trying to find a way to create custom capabilities. I've gone through the NEWMODULE tutorials, but what I want is to create a system level capability. eg moodle/site:superadminpowers So that I can then check it with has_capability with the 4th parameter (doanything) set to false.

Basically what the end goal is, is to create a second uber-admin role that developer/admins can use to access certain pages that client/admins can't.

Thanks for you help,
Donnie
Average of ratings: -
In reply to Donnie Hedin

Re: Adding custom capabilities

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
Hi there. Sorry I don't quite get you - why is merely making a second admin via site admin>users>permissions>assign system roles not acceptable? How do you want it to be different?
In reply to Mary Cooch

Re: Adding custom capabilities

by Donnie Hedin -
I want it to add special capabilities to one of them, we want the client's administrators to do almost everything in the site. But there's a few areas where they can, and have been known to, do things that can screw up the database.
In reply to Donnie Hedin

Re: Adding custom capabilities

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
Why not go to site admin>users>permissions>defiine roles and create a new role and then allow/prevent as you wish?
In reply to Mary Cooch

Re: Adding custom capabilities

by Donnie Hedin -
Because we're really looking to add capabilities on top of the default admin, the client administrators should be able to do everything they could in a basic moodle install, which is why we still need them to have site:doanything. The uber-admin will be able to access content in a few custom coded areas that aren't coded as modules, so the easiest way I can think of is to just add one extra capability to check against.
In reply to Donnie Hedin

Re: Adding custom capabilities

by Donnie Hedin -
I've figured it out, thanks.
In reply to Donnie Hedin

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: Adding custom capabilities

by Farhan Karmali -
Picture of Core developers Picture of Plugin developers Picture of Testers

Really old post but , has anyone found an ideal way to do this? I was thinking of making a local plugin and defining capabilities there