Moodle

Add role reset button into role definition form

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.7
  • Fix Version/s: 1.8, 1.9
  • Component/s: Roles / Access
  • Labels:
    None
  • Affected Branches:
    MOODLE_17_STABLE
  • Fixed Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE

Description

The default capability settings for roles are sometimes changing between releases, there is no proper documentation yet - admins are complaining.

Issue Links

Activity

Hide
Petr Škoda (skodak) added a comment -

fixed in cvs

Show
Petr Škoda (skodak) added a comment - fixed in cvs
Hide
Helen Foster added a comment -

Hi Petr,

Just testing this improvement and found it confusing to have the role reset button appear for new roles.

For example:

1. Create a duplicate teacher role and change some permissions.
2. Click the role reset button and obtain the message "Are you sure that you want to reset role "Teacher copy 1 (editingteache_1)" to defaults?"
3. Choose Yes.

Expected result: Role reset
Actual result: Nothing changed

Is it possible to hide the role reset button for new roles?

Show
Helen Foster added a comment - Hi Petr, Just testing this improvement and found it confusing to have the role reset button appear for new roles. For example: 1. Create a duplicate teacher role and change some permissions. 2. Click the role reset button and obtain the message "Are you sure that you want to reset role "Teacher copy 1 (editingteache_1)" to defaults?" 3. Choose Yes. Expected result: Role reset Actual result: Nothing changed Is it possible to hide the role reset button for new roles?
Hide
Petr Škoda (skodak) added a comment -

I have changed the strings a bit, it works as following:

  • If role has legacy type selected - it is reset to default permissions for legacy type
  • If no legacy selected - all permissions are cleared

please help me with the languages strings so that ppl understand that

$string['resetrolesure'] = 'Are you sure that you want to reset role \"$a->name ($a->shortname)\" to defaults?<p></p>The defaults are taken from the selected legacy capability ($a->legacytype).';

$string['resetrolesurenolegacy'] = 'Are you sure that you want to removed all permissions defined in this role \"$a->name ($a->shortname)\"?';

Show
Petr Škoda (skodak) added a comment - I have changed the strings a bit, it works as following:
  • If role has legacy type selected - it is reset to default permissions for legacy type
  • If no legacy selected - all permissions are cleared
please help me with the languages strings so that ppl understand that $string['resetrolesure'] = 'Are you sure that you want to reset role \"$a->name ($a->shortname)\" to defaults?<p></p>The defaults are taken from the selected legacy capability ($a->legacytype).'; $string['resetrolesurenolegacy'] = 'Are you sure that you want to removed all permissions defined in this role \"$a->name ($a->shortname)\"?';
Hide
Helen Foster added a comment -

Hi Petr,

I tested your changes using the duplicate teacher role example above and found that the reset button worked exactly as expected

However, I think the role reset button for new roles is still confusing.

Example 2:

1. Create a new role allowing moodle/legacy:editingteacher only.
2. Click the role reset button and obtain the message "Are you sure that you want to reset role "new role (new2)" to defaults? The defaults are taken from the selected legacy capability (editingteacher)."
3. Choose Yes.

Result: All legacy editingteacher permissions are set, even though they weren't before!

I still think it would be preferable if the role reset button is hidden for new roles.

Isn't it simpler to just delete any new role with no legacy selected rather than having to reset it to clear all permissions?

Show
Helen Foster added a comment - Hi Petr, I tested your changes using the duplicate teacher role example above and found that the reset button worked exactly as expected However, I think the role reset button for new roles is still confusing. Example 2: 1. Create a new role allowing moodle/legacy:editingteacher only. 2. Click the role reset button and obtain the message "Are you sure that you want to reset role "new role (new2)" to defaults? The defaults are taken from the selected legacy capability (editingteacher)." 3. Choose Yes. Result: All legacy editingteacher permissions are set, even though they weren't before! I still think it would be preferable if the role reset button is hidden for new roles. Isn't it simpler to just delete any new role with no legacy selected rather than having to reset it to clear all permissions?
Hide
Petr Škoda (skodak) added a comment -

What if we call the button "Set defaults" if legacy present and "Reset" if no legacy set?

Show
Petr Škoda (skodak) added a comment - What if we call the button "Set defaults" if legacy present and "Reset" if no legacy set?
Hide
Helen Foster added a comment -

The more I play around with role reset, the more I wish it could be disabled for new roles. Otherwise it always gives unexpected results.

However, if this is just not possible then perhaps the language strings could read:

$string['resetrolesure'] = 'Are you sure that you want to reset role \"$a->name ($a->shortname)\" to defaults?';

$string['resetrolesurenolegacy'] = 'Are you sure that you want to clear all permissions defined in the role \"$a->name ($a->shortname)\"?';

Show
Helen Foster added a comment - The more I play around with role reset, the more I wish it could be disabled for new roles. Otherwise it always gives unexpected results. However, if this is just not possible then perhaps the language strings could read: $string['resetrolesure'] = 'Are you sure that you want to reset role \"$a->name ($a->shortname)\" to defaults?'; $string['resetrolesurenolegacy'] = 'Are you sure that you want to clear all permissions defined in the role \"$a->name ($a->shortname)\"?';
Hide
Petr Škoda (skodak) added a comment -

The reset button has now different label and confirmation if legacy type set.
going to file a new report for legacy roles confusion..

thanks for the feedback

Show
Petr Škoda (skodak) added a comment - The reset button has now different label and confirmation if legacy type set. going to file a new report for legacy roles confusion.. thanks for the feedback
Hide
Helen Foster added a comment -

Closing, since everyone seems happy with the reset to defaults button. Thanks Petr

Show
Helen Foster added a comment - Closing, since everyone seems happy with the reset to defaults button. Thanks Petr

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: