-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New setting for identification use #95
base: master
Are you sure you want to change the base?
Changes from all commits
af92f90
7b7a9fe
eecb388
a93f9a1
547f11f
0d24da0
5fd42b1
7723ea0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -70,6 +70,10 @@ | |||||
1. Use "selectOrAdd" for EQUELLA 6.0 and older, for EQUELLA 6.1 onward please use "structured" | ||||||
2. There should not be a ? or a & at the start or end of the string.'; | ||||||
|
||||||
$string['config.userfield.title'] = 'User field to use'; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
$string['config.userfield.desc'] = 'Choose the user field to be used instead of username'; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
$string['config.userfield.username'] = 'Username'; | ||||||
|
||||||
$string['config.restriction.title'] = 'Restrict selections'; | ||||||
$string['config.restriction.desc'] = 'Choose whether course editors should only be able to select items, attachments, packages or anything. Please note that the restrictions only working for EQUELLA 6.0 and higher.'; | ||||||
$string['config.restriction.none'] = 'No restrictions'; | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -635,3 +635,17 @@ function equella_grade_item_delete($eq) { | |
return grade_update(EQUELLA_SOURCE, $eq->courseid, EQUELLA_ITEM_TYPE, EQUELLA_ITEM_MODULE, $eq->id, 0, NULL, array('deleted'=>1)); | ||
} | ||
|
||
/** | ||
* Select the corresponding field to allocate the username to $USER | ||
*/ | ||
function mod_equella_after_config(){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure if you need this callback. The configured SSO identification field is available in |
||
global $USER, $CFG; | ||
if(!isset($USER->equellauser) && isset($USER->username)) { | ||
$userfield = $CFG->equella_userfield; | ||
if ($userfield != 'default' && isset($USER->profile[$userfield])) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can I ask where is |
||
$USER->equellauser = $USER->profile[$userfield]; | ||
} else { | ||
$USER->equellauser = $USER->username; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,13 @@ function ecs($configoption, $params = null) { | |
$settings->add(new admin_setting_configtext('equella_url', ecs('url.title'), ecs('url.desc'), '')); | ||
$settings->add(new admin_setting_configtext('equella_action', ecs('action.title'), ecs('action.desc'), '')); | ||
|
||
$userfieldoptions = array(); | ||
$userfieldoptions = array('default' => ecs('userfield.username')); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of
|
||
foreach($DB->get_records('user_info_field') as $params){ | ||
$userfieldoptions[$params->shortname] = $params->name; | ||
} | ||
$settings->add(new admin_setting_configselect('equella_userfield', ecs('userfield.title'), ecs('userfield.desc'), 'default', $userfieldoptions)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As above, why not use Username as the default option ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure if this setting should be under I think it's good to have a separate section named |
||
|
||
$restrictionOptions = array(EQUELLA_CONFIG_SELECT_RESTRICT_NONE => trim(ecs('restriction.none')),EQUELLA_CONFIG_SELECT_RESTRICT_ITEMS_ONLY => trim(ecs('restriction.itemsonly')),EQUELLA_CONFIG_SELECT_RESTRICT_ATTACHMENTS_ONLY => trim(ecs('restriction.attachmentsonly')), | ||
EQUELLA_CONFIG_SELECT_RESTRICT_PACKAGES_ONLY => trim(ecs('restriction.packagesonly'))); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
$plugin->version = 2023070300; | ||
$plugin->version = 2023070300.3; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We typically do not have decimal in the version. It can be the date when you made the commit. |
||
$plugin->requires = 2014041101; // Requires this Moodle version | ||
$plugin->component = 'mod_equella'; // Full name of the plugin (used for diagnostics) | ||
$plugin->release = '1.3.1'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you do
$CFG -> equellauser
? I just compared this one with other settings and they are all access from $CFG.