? 227947-redirect.patch ? 615258-path-source.patch ? 615294-enforce.patch ? 617312-user.patch ? test.patch Index: domain_user/README.txt =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/domain/domain_user/README.txt,v retrieving revision 1.6 diff -u -p -r1.6 README.txt --- domain_user/README.txt 30 Mar 2008 17:51:47 -0000 1.6 +++ domain_user/README.txt 31 Oct 2009 16:35:51 -0000 @@ -22,9 +22,10 @@ CONTENTS 4.2 Root Domain Name 4.3 User Domain URL Scheme 4.4 User Login Behavior -4.5 Domain Table Prefixing * -4.6 Reserved Usernames -4.7 Domain Settings Page +4.5 Assigned User Domains +4.6 Domain Table Prefixing * +4.7 Reserved Usernames +4.8 Domain Settings Page 5. Developer Notes 5.1 hook_user() Implementation 5.2 Domain API Hooks @@ -102,6 +103,12 @@ the Domain User settings page. Domain User adds one permission to your Access Control page: -- 'create personal domain' + Allows users to create a personal domain when registering or + updating their accounts. + + -- 'create user domains' + Allows a site administrator to create user domains on behalf + of some other user. Only roles that have this permission can create personal subdomains. @@ -200,7 +207,19 @@ Because of how Drupal login works, this trigger the redirect. ---- -4.5 Domain Table Prefixing * +4.5 Assigned User Domains + +Controls which domains a user is assigned to for editing purposes. The options +are: + + -- Assign only to the user domain [default] + -- Assign to both user domain and active domain + +NOTE: If a user domain is deleted, the user will be assigned to the primary +domain. + +---- +4.6 Domain Table Prefixing * This setting is only available if you have the Domain Prefix module turned on. Since Domain Prefix is a powerful module that creates extra database tables, @@ -215,7 +234,7 @@ Note that "obey the settings" may not cr since Domain Prefix has its own behavior settings. ---- -4.6 Reserved Usernames +4.7 Reserved Usernames At the bottom of the Domain User settings page is a list of all reserved usernames. This list is derived from the administrator-created list of domains. @@ -223,7 +242,7 @@ usernames. This list is derived from th Users should not be able to register or login with any username listed here. ---- -4.7 Domain List Page +4.8 Domain List Page Note that on the main Domain list page at Admin > Build > Domains > Domain list, a new column is added to the domain table. This column shows the username Index: domain_user/domain_user.admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/domain/domain_user/domain_user.admin.inc,v retrieving revision 1.3 diff -u -p -r1.3 domain_user.admin.inc --- domain_user/domain_user.admin.inc 10 Oct 2008 20:19:28 -0000 1.3 +++ domain_user/domain_user.admin.inc 31 Oct 2009 16:35:51 -0000 @@ -46,6 +46,13 @@ function domain_user_configure_form() { '#default_value' => variable_get('domain_user_login', 1), '#description' => t('The domain users should go to when they login to the site.') ); + $form['domain_user_assign'] = array( + '#type' => 'radios', + '#title' => t('Assign user domains'), + '#options' => array(0 => t('Only assign to user domain'), 1 => t('Assign to both user domain and active domain')), + '#default_value' => variable_get('domain_user_assign', 0), + '#description' => t('Indicates which domains should the user be assigned to when new user accounts are created.') + ); if (module_exists('domain_prefix')) { $form['domain_user_prefixing'] = array( '#type' => 'radios', Index: domain_user/domain_user.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/domain/domain_user/domain_user.module,v retrieving revision 1.27 diff -u -p -r1.27 domain_user.module --- domain_user/domain_user.module 31 May 2009 18:16:41 -0000 1.27 +++ domain_user/domain_user.module 31 Oct 2009 16:35:52 -0000 @@ -47,7 +47,7 @@ function domain_user_menu() { * Implement hook_perm() */ function domain_user_perm() { - return array('create personal domain'); + return array('create personal domain', 'create user domains'); } /** @@ -146,6 +146,10 @@ function domain_user_user($op, &$edit, & if (isset($account->uid)) { $domain = domain_user_lookup($account->uid); } + else { + $account->uid = 0; + $account->roles = array(0 => t('anonymous user')); + } // New users throw E_ALL errors. $name = t('username'); if (isset($account->name)) { @@ -158,7 +162,11 @@ function domain_user_user($op, &$edit, & // TODO: Maybe we should set a message here. if ($domain == -1 && domain_lookup(NULL, $name .'.'. $root) == -1) { $create_domain = variable_get('domain_user', 0); - if (user_access('create personal domain', $account)) { + if (user_access('create personal domain', $account) || user_access('create user domains')) { + // For the add user page, we force the checkbox. + if (empty($account->uid) && arg(0) == 'admin' && $create_domain == 1) { + $create_domain = 2; + } if ($create_domain == 1 && !empty($root)) { $form['domain_user_domain']['domain_create_user'] = array( '#type' => 'value', @@ -189,7 +197,7 @@ function domain_user_user($op, &$edit, & if (!isset($edit['domain_create_user'])) { return; } - if (!empty($edit['domain_create_user']) && user_access('create personal domain', $account)) { + if (!empty($edit['domain_create_user']) && (user_access('create personal domain', $account) || !user_access('create user domains'))) { $user_root = variable_get('domain_user_root', variable_get('domain_root', '')); $name = domain_user_strip_chars($account->name); $form_state['values']['sitename'] = $account->name; @@ -209,6 +217,11 @@ function domain_user_user($op, &$edit, & $domain = domain_lookup(NULL, $form_state['values']['subdomain'], TRUE); if ($domain['domain_id']) { db_query("INSERT INTO {domain_user} (domain_id, uid) VALUES (%d, %d)", $domain['domain_id'], $account->uid); + // If this user has never registered before, or settings require it, remove other domain editing permissions. + if (empty($account->login) || !variable_get('domain_user_assign', 0)) { + db_query("DELETE FROM {domain_editor} WHERE uid = %d", $account->uid); + } + db_query("INSERT INTO {domain_editor} (domain_id, uid) VALUES (%d, %d)", $domain['domain_id'], $account->uid); $edit['domains'][] = $domain['domain_id']; drupal_set_message(t('Your personal URL is !url.', array('!url' => url($domain['path'])))); } @@ -229,8 +242,8 @@ function domain_user_user($op, &$edit, & } } } - if (isset($edit['domain_create_user']) && !user_access('create personal domain', $account)) { - drupal_set_message(t('Your personal URL could not be created. 2')); + if (isset($edit['domain_create_user']) && !user_access('create personal domain', $account) && !user_access('create user domains')) { + drupal_set_message(t('Your personal URL could not be created.')); } // Throw away what we do not need. $edit['domain_create_user'] = NULL; @@ -300,6 +313,14 @@ function domain_user_domainupdate($op, $ case 'delete': // Delete from {domain_user} db_query("DELETE FROM {domain_user} WHERE domain_id = %d", $domain['domain_id']); + // Move from user domain to default domain for {domain_editor} + $check = db_result(db_query("SELECT COUNT(uid) FROM {domain_editor} WHERE uid = %d AND domain_id = 0", $domain['uid'])); + if (empty($check)) { + db_query("INSERT INTO {domain_editor} (domain_id, uid) VALUES (0, %d)", $domain['uid'], $domain['domain_id']); + } + else { + db_query("DELETE FROM {domain_editor} WHERE uid = %d AND domain_id = %d", $domain['uid'], $domain['domain_id']); + } // Delete from the access rules. $user_root = variable_get('domain_user_root', variable_get('domain_root', '')); $mask = str_replace('.'. $user_root, '', $domain['subdomain']);