mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #2780 from madmatt/pulls/securityadmin-js2
BUGFIX: Fix JS for PermissionCheckboxsetField in SecurityAdmin
This commit is contained in:
commit
ce3a944903
@ -10,8 +10,6 @@
|
|||||||
$('.permissioncheckboxset .valADMIN input').entwine({
|
$('.permissioncheckboxset .valADMIN input').entwine({
|
||||||
onmatch: function() {
|
onmatch: function() {
|
||||||
this._super();
|
this._super();
|
||||||
|
|
||||||
this.toggleCheckboxes();
|
|
||||||
},
|
},
|
||||||
onunmatch: function() {
|
onunmatch: function() {
|
||||||
this._super();
|
this._super();
|
||||||
@ -55,13 +53,7 @@
|
|||||||
}).find('.checkbox').not(this);
|
}).find('.checkbox').not(this);
|
||||||
},
|
},
|
||||||
onmatch: function() {
|
onmatch: function() {
|
||||||
var checkboxes = this.getCheckboxesExceptThisOne();
|
this.toggleCheckboxes();
|
||||||
if($(this).is(':checked')) {
|
|
||||||
checkboxes.each(function() {
|
|
||||||
$(this).attr('disabled', 'disabled');
|
|
||||||
$(this).attr('checked', 'checked');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
this._super();
|
this._super();
|
||||||
},
|
},
|
||||||
@ -69,6 +61,9 @@
|
|||||||
this._super();
|
this._super();
|
||||||
},
|
},
|
||||||
onclick: function(e) {
|
onclick: function(e) {
|
||||||
|
this.toggleCheckboxes();
|
||||||
|
},
|
||||||
|
toggleCheckboxes: function() {
|
||||||
var checkboxes = this.getCheckboxesExceptThisOne();
|
var checkboxes = this.getCheckboxesExceptThisOne();
|
||||||
if($(this).is(':checked')) {
|
if($(this).is(':checked')) {
|
||||||
checkboxes.each(function() {
|
checkboxes.each(function() {
|
||||||
|
36
tests/behat/features/security-permissions.feature
Normal file
36
tests/behat/features/security-permissions.feature
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
@javascript
|
||||||
|
Feature: Manage Security Permissions for Groups
|
||||||
|
As a site administrator
|
||||||
|
I want to control my user's security permissions in an intuitive way
|
||||||
|
So that I can easily control access to the CMS
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given a "member" "ADMIN" belonging to "ADMIN Group" with "Email"="admin@test.com"
|
||||||
|
And the "group" "ADMIN group" has permissions "Full administrative rights"
|
||||||
|
And I am logged in with "ADMIN" permissions
|
||||||
|
And I go to "/admin/security"
|
||||||
|
|
||||||
|
Scenario: I can change permissions easily
|
||||||
|
When I click the "Groups" CMS tab
|
||||||
|
And I press the "Add Group" button
|
||||||
|
And I click the "Permissions" CMS tab
|
||||||
|
And I check "Access to 'Pages' section"
|
||||||
|
And I check "Access to all CMS sections"
|
||||||
|
Then the "Access to 'Reports' section" checkbox should be checked
|
||||||
|
And I uncheck "Access to all CMS sections"
|
||||||
|
Then the "Access to 'Reports' section" checkbox should not be checked
|
||||||
|
And the "Access to 'Pages' section" checkbox should be checked
|
||||||
|
And I uncheck "Access to 'Pages' section"
|
||||||
|
And I check "Full administrative rights"
|
||||||
|
Then the "Access to 'Reports' section" checkbox should be checked
|
||||||
|
And I press the "Create" button
|
||||||
|
And I click the "Permissions" CMS tab
|
||||||
|
Then the "Full administrative rights" checkbox should be checked
|
||||||
|
And the "Access to 'Pages' section" checkbox should be checked
|
||||||
|
And I uncheck "Full administrative rights"
|
||||||
|
Then the "Access to 'Pages' section" checkbox should not be checked
|
||||||
|
And I check "Access to all CMS sections"
|
||||||
|
And I press the "Save" button
|
||||||
|
Then the "Access to 'Pages' section" checkbox should be checked
|
||||||
|
And I uncheck "Access to all CMS sections"
|
||||||
|
Then the "Access to 'Pages' section" checkbox should not be checked
|
Loading…
Reference in New Issue
Block a user