diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3fc866b8b..22fc668a7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,6 @@
* **Build 16x** (2014-12-x)
- Native `alert` and `confirm` functions have been styled in the back-end.
+ - Back-end user groups can now be marked to add new administrators by default. This affects when a group is created (if checked, all administrators are added to the group) and creating a new administrator (the default groups are checked by default).
* **Build 168** (2014-12-14)
- Config item `cms.customErrorPage` is deprecated, the setting `app.debug` should be used instead.
diff --git a/modules/backend/controllers/Groups.php b/modules/backend/controllers/UserGroups.php
similarity index 97%
rename from modules/backend/controllers/Groups.php
rename to modules/backend/controllers/UserGroups.php
index 1ec3ff8c7..0eb6c4f9a 100644
--- a/modules/backend/controllers/Groups.php
+++ b/modules/backend/controllers/UserGroups.php
@@ -11,7 +11,7 @@ use Backend\Classes\Controller;
* @author Alexey Bobkov, Samuel Georges
*
*/
-class Groups extends Controller
+class UserGroups extends Controller
{
public $implement = [
'Backend.Behaviors.FormController',
diff --git a/modules/backend/controllers/Users.php b/modules/backend/controllers/Users.php
index 7c1e6c5db..a97ed5b91 100644
--- a/modules/backend/controllers/Users.php
+++ b/modules/backend/controllers/Users.php
@@ -4,6 +4,7 @@ use Backend;
use Redirect;
use BackendMenu;
use BackendAuth;
+use Backend\Models\UserGroup;
use Backend\Classes\Controller;
use System\Classes\SettingsManager;
@@ -85,6 +86,7 @@ class Users extends Controller
/**
* Add available permission fields to the User form.
+ * Mark default groups as checked for new Users.
*/
protected function formExtendFields($form)
{
@@ -121,5 +123,15 @@ class Users extends Controller
}
$form->addTabFields($permissionFields);
+
+ /*
+ * Mark default groups
+ */
+ if (!$form->model->exists) {
+ $defaultGroupIds = UserGroup::where('is_new_user_default', true)->lists('id');
+
+ $groupField = $form->getField('groups');
+ $groupField->value = $defaultGroupIds;
+ }
}
}
diff --git a/modules/backend/controllers/groups/_list_toolbar.htm b/modules/backend/controllers/groups/_list_toolbar.htm
deleted file mode 100644
index 5a25508df..000000000
--- a/modules/backend/controllers/groups/_list_toolbar.htm
+++ /dev/null
@@ -1,3 +0,0 @@
-
\ No newline at end of file
diff --git a/modules/backend/controllers/groups/index.htm b/modules/backend/controllers/usergroups/index.htm
similarity index 100%
rename from modules/backend/controllers/groups/index.htm
rename to modules/backend/controllers/usergroups/index.htm
diff --git a/modules/backend/controllers/groups/update.htm b/modules/backend/controllers/usergroups/update.htm
similarity index 87%
rename from modules/backend/controllers/groups/update.htm
rename to modules/backend/controllers/usergroups/update.htm
index d5893e1ab..3b19df71b 100644
--- a/modules/backend/controllers/groups/update.htm
+++ b/modules/backend/controllers/usergroups/update.htm
@@ -1,7 +1,7 @@
\ No newline at end of file
diff --git a/modules/backend/controllers/users/_list_toolbar.htm b/modules/backend/controllers/users/_list_toolbar.htm
index 3563ce7ed..5e45e1d3d 100644
--- a/modules/backend/controllers/users/_list_toolbar.htm
+++ b/modules/backend/controllers/users/_list_toolbar.htm
@@ -1,6 +1,6 @@