config.php variables - change syntax (eg. moodle/user:manageownfiles)

config.php variables - change syntax (eg. moodle/user:manageownfiles)

by Franzi Hubert -
Number of replies: 10
Hi!
As my search was not really successful: does anybody know how to preset below specific settings in the cfg file (moodle 2.7)?

eg: I want to deactivate "My Files" , (this can be done in
Site Admin > Users > Permissions > Define Roles)

This section states this variable in "Manage files on own private file areas : Allow":
moodle/user:manageownfiles

and: repository/user:view

So what is the correct string to enter in the config.php to change the default setting from Allow to Disallow?
$CFG->moodle/user:manageownfiles = '??'

Any help is highly appreciated,
Thanks!
Franz
Average of ratings: -
In reply to Franzi Hubert

Re: config.php variables - change syntax (eg. moodle/user:manageownfiles)

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Is there a specific reason that you want to do this in the config file?  You can just change the permission for each specific role just as effectively in the site admin/users/permissions/define roles area.  Plus this allows you to leave it enabled for some roles (teachers for example).

In reply to Emma Richardson

Re: config.php variables - change syntax (eg. moodle/user:manageownfiles)

by Franzi Hubert -

I need to have an automated moodle setup and try to put as much config into the config.php as possible (to decrease manual changes after setup)

--Franz

In reply to Franzi Hubert

Re: config.php variables - change syntax (eg. moodle/user:manageownfiles)

by Sergio Rabellino -
Picture of Particularly helpful Moodlers Picture of Plugin developers
Simple answer: AFAIK you cannot do this in the config.php.

The capabilities are tied to roles, so you need to configure each role and disallow these capabilities as suggested in the moodle docs.

best regards.
In reply to Franzi Hubert

Re: config.php variables - change syntax (eg. moodle/user:manageownfiles)

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Yes - let's take a step back here. What problem are you trying to solve?

In reply to Howard Miller

Re: config.php variables - change syntax (eg. moodle/user:manageownfiles)

by Franzi Hubert -

I need to have an automated moodle setup and try to put as much config into the config.php as possible.

--Franz
In reply to Franzi Hubert

Re: config.php variables - change syntax (eg. moodle/user:manageownfiles)

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

The majority of us are going to try and persuade you to use Moodle as it is intended.  Putting settings in config.php (even if it can be done which I am not sure) is likely to create headaches down the road.  I just imagine that you are going to have a hard time coming up with enough settings to take care of every scenario.  e.g. What if someone creates a new role?  Then you would need to go back to your config file and add another setting for the new role...

There is a great plugin called Admin Presets - it will export all your admin settings for import into another site.  With this plugin you can set Moodle up the way you want and then export the settings to an xml file.  If you need to reset them later on, you can just import the settings from the file and set it back the way you want it.

Sorry - not being helpful on your original question!

Average of ratings: Useful (1)
In reply to Emma Richardson

Re: config.php variables - change syntax (eg. moodle/user:manageownfiles)

by Franzi Hubert -

Yes, I am aware of at least some of the problems of putting too much presets into the configfile.
However, I assumed that the "manageownfiles" can be preset anyhow - like others (eg updatenotification)

But many thanks for pointing me to the Admin Preset plugin!!

In reply to Franzi Hubert

Re: config.php variables - change syntax (eg. moodle/user:manageownfiles)

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

You still haven't really told us *why* you want to do this. If you are distributing some sort of customised Moodle version that sets itself up in a particular way then quite a lot is possible but you may need to write some code. Possibilities are very limited in config.php - you will need to look elsewhere.

The first thing to read is the file local/readme.txt (https://github.com/moodle/moodle/blob/master/local/readme.txt), especially towards the end, "Other local customisation files".

Local plugins are guaranteed to be loaded last, so you can create a dummy plugin that implements a db/install.php script that can manipulate (things like) roles. You will need to study the functions in lib/accesslib.php to see how to do that though. 

Have a look at custom roles being created in Iomad (www.iomad.org) to get an idea: https://github.com/iomad/iomad/blob/IOMAD_28_STABLE/local/iomad/db/install.php

In reply to Howard Miller

Re: config.php variables - change syntax (eg. moodle/user:manageownfiles)

by Franzi Hubert -

I need to rollout many identical moodle installs with specific requirements/settings - and stop moodle admins to make some changes on some of these specific settings.

Thanks for the link where to start best!

In reply to Franzi Hubert

Re: config.php variables - change syntax (eg. moodle/user:manageownfiles)

by Just H -

Just stumbled over a plugin that could be useful to you: Admin Presets.

Just installing now to have a play with it but in your use case I could see you creating a preset from your master site and importing to your cloned sites (should be able to write a script to automate I would think?).