/[drupal]/contributions/modules/domain/README.txt
ViewVC logotype

Contents of /contributions/modules/domain/README.txt

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.72 - (show annotations) (download)
Sun Nov 1 18:20:19 2009 UTC (3 weeks, 5 days ago) by agentken
Branch: MAIN
CVS Tags: DRUPAL-6--2-0, HEAD
Branch point for: DRUPAL-6--2
Changes since 1.71: +9 -1 lines
File MIME type: text/plain
-- #372887 patch by nonsie and blackdog. Super-awesome set values for all domains in domain batch.
-- Creates the 6.x.2.0 stable release.
1 // $Id: README.txt,v 1.71 2009/10/31 19:12:04 agentken Exp $
2
3 /**
4 * @file
5 * README file for Domain Access.
6 */
7
8 Domain Access
9 A domain-based access control system.
10
11 CONTENTS
12 --------
13
14 1. Introduction
15 1.1 Use-Case
16 1.2 Examples
17 1.3 Using Multiple Node Access Modules
18 1.4 Known Issues
19 1.4.1 Logging In To Multiple Domains
20 1.4.2 Cron Handling
21 1.4.3 Updating Your Site
22 2. Installation
23 2.1 Patches to Drupal Core
24 2.1.1 multiple_node_access.patch
25 2.2 Server Configuration
26 2.3 Creating Domain Records
27 2.4 Setting DOMAIN_INSTALL_RULE
28 2.5 Setting DOMAIN_SITE_GRANT
29 2.6 Setting DOMAIN_ASSIGN_USERS
30 3. Permissons
31 3.1 Module Permissions
32 3.2 Normal Usage
33 3.3 Advanced Usage
34 3.4 Limitations
35 4. Module Configuration
36 4.1 Default Domain Settings
37 4.1.1 Primary Domain Name
38 4.1.2 Site Name
39 4.1.3 Domain URL Scheme
40 4.2 Creating Domain Records
41 4.3 Domain Module Behaviors
42 4.3.1 New Content Settings
43 4.3.2 Debugging Status
44 4.3.3 Enforce Rules on Adminstrators
45 4.3.4 Sort Domain Lists
46 4.3.5 Domain Selection Format
47 4.4 Advanced Settings
48 4.4.1 Search Settings
49 4.4.2 Search Engine Optimization
50 4.4.3 Default Source Domain
51 4.4.4 WWW Prefix Handling
52 4.4.5 Node Access Settings
53 4.5 Special Page Requests
54 4.5.1 Cron Handling
55 4.6 Node Link Patterns
56 4.7 The Domain List
57 4.8 Node Settings
58 4.8.1 Domain Node Editing
59 4.8.2 Domain Node Types
60 4.9 Batch Updating
61 4.10 Assigning Users to Domains
62 4.11 Batch Assignment of Users to Domains
63 5. Blocks
64 5.1 Block -- Domain Switcher
65 5.2 Block -- Domain Access Information
66 6. Node Access
67 6.1 Assigning Domain Access
68 6.2. Editor Access
69 6.3 Realms
70 6.4 Grants
71 6.5 Warnings
72 7. Developer Notes
73 7.1 Extension Modules
74 7.2 The $_domain Global
75 7.3 Database Schema
76 7.4 API
77 7.5 drush and Domain Access
78 7.6 Domain Tokens
79
80
81 ----
82 1. Introduction
83
84 Before using the module, you should read the installation instructions found
85 in INSTALL_QUICKSTART.txt.
86
87 The Domain Access module group is designed to run an affiliated network of sites
88 from a single Drupal installation. The module allows you to share users,
89 content, and configurations across a group of sites such as:
90
91 - example.com
92 - one.example.com
93 - two.example.com
94 - my.example.com
95 - thisexample.com
96 - anothersite.com
97 - example.com:3000 <-- non-standard ports are treated as unique domains.
98
99 By default, these sites share all tables in your Drupal installation.
100
101 The module uses Drupal's node_access() system to determine what content is
102 available on each site in the network. Unlike other multi-domain modules for
103 Drupal, the Domain Access module determines user access based on the active
104 domain that the user is viewing, rather than which group or site the user
105 belongs to.
106
107 Additionally, when a user creates content, that content will automatically be
108 assigned to the currently active domain unless the user has specific
109 privileges to be able to assign domain access. Under advanced setups, the
110 ability to edit content for a specific domain can be segregated from the
111 typical Drupal privilege to 'administer nodes.'
112
113 For more information about Domain Access privileges, see section 3.
114
115 For more information about node_access(), see
116 http://api.drupal.org/api/group/node_access/6
117
118 ----
119 1.1 Use-Case
120
121 The module was initially developed for a web site that sold franchises of a
122 monthly magazine. The publishing rules were as follows:
123
124 - Content may belong to the national site, one or more affiliates, or to
125 all affiliates.
126 - National editors may select to promote affiliate content to other
127 affiliates, the national site, or to all affiliates.
128 - Local editors may only create and edit content for their own affiliate
129 sites.
130
131 These rules are enforced programmatically by the Domain Access module. There
132 was concern that, if given a choice to make, local editors would not assign the
133 content correctly. Therefore, the module handles this automatically, and local
134 editors have no control over which domains their content is published to.
135
136 ----
137 1.2 Examples
138
139 For the original example of the module in use, see http://skirt.com/.
140
141 ----
142 1.3 Using Multiple Node Access Modules
143
144 Node Access is a complex issue in Drupal. Typically, sites will only use
145 one node access module at a time. In some cases, you may require
146 more advances acceess control rules.
147
148 Domain Access attempts to integrate with other node access modules
149 in two ways:
150
151 -- First, the multiple_node_access patch allows you to configure the
152 Domain Access module to use AND logic instead of OR logic when
153 adding Domain Access controls to your site.
154 -- Second, Domain Access does not use db_rewrite_sql in any way.
155 The module lets Drupal's core node access system handle this.
156
157 As a result, there may exist conflicts between Domain Access and other
158 contributed modules that try to solve this issue.
159
160 Domain Access has been tested to work with the Organic Groups module,
161 but may require the solution in http://drupal.org/node/234087.
162
163 If you experience conflicts with other node access modules, you
164 should uninstall the multiple_node_access patch. This will restore the
165 default Drupal behavior that your other modules are expecting.
166
167 For background, see:
168
169 -- http://drupal.org/node/196922
170 -- http://drupal.org/node/191375
171 -- http://drupal.org/node/122173
172 -- http://drupal.org/node/201156
173 -- http://drupal.org/node/234087
174
175 ----
176 1.4 Known Issues
177
178 There are some issues that occur when Domain Access is used outside
179 of its original use case. These are probably fixable, but may not work
180 as you expect. You should pay careful attention to your site behavior.
181
182 ----
183 1.4.1 Logging In To Multiple Domains
184
185 The Domain Access module allows the creation of domains with different
186 hosts. However, security standards dictate that cookies can only be
187 read from the issuing domain.
188
189 As a result, you may configure your site as follows, but when you do so,
190 users cannot be logged through a single sign in.
191
192 example.com
193 one.example.com
194 myexample.com
195 thisexample.com
196
197 While example.com and one.example.com can share a login cookie, the
198 other two domains cannot read that cookie. This is an internet standard,
199 not a bug.
200
201 Note: See the INSTALL.txt for instructions regarding Drupal's default
202 cookie handling.
203
204 ----
205 1.4.2 Cron Handling
206
207 When Drupal's cron function runs, it operates on the domain from which
208 the cron.php script is invoked. That is, if you setup cron to run from:
209
210 http://one.example.com/cron.php
211
212 In this case, Domain Access will check the access settings for that domain.
213
214 This behavior has been known to cause issues with other contributed modules.
215 As a solution, we normally disable Domain Access rules when cron runs.
216
217 For more information, see section 4.4.1 Cron Handling.
218
219 If you encounter any cron-related issues, please report them at:
220
221 http://drupal.org/project/issues/domain
222
223 ----
224 1.4.3 Updating Your Site
225
226 If prefixing database tables, it is possible that Drupal's update.php script
227 may not update all mdoule tables correctly.
228
229 This issue only occurs if you use the Domain Prefix module. It is possible
230 that database updates will not be applied to prefixed tables.
231
232 For more information, see the Drupal Upgrades section of the Domain Prefix
233 README.txt file.
234
235 ----
236 2. Installation
237
238 WARNING: The Domain Access module assumes that you have already installed
239 and configured your Drupal site. Please do so before continuing.
240
241 Installing the module requires that you share a single copy of settings.php
242 for all domains that will be registered with Domain Access.
243
244 You must also add code to that settings.php file in order to load the domain
245 handling code. See INSTALL_QUICKSTART.txt for instructions.
246
247 For detailed instructions, see INSTALL.txt.
248
249 After you have completed the steps outlined by the installer, you may enable
250 the module normally. When you enable the module, it will create a {domain} table
251 in your Drupal database.
252
253 All existing nodes and users on your site will be assigned to the default domain
254 for your web site. Existing content will be set to be visible on all new
255 domains. If you wish to alter this behavior, see sections 2.4 through 2.6.
256
257 ----
258 2.1 Patch to Drupal Core
259
260 The following patch is optional. They affect advanced behavior of the
261 Domain Access module.
262
263 The patch is distributed in the 'patches' folder of the download.
264
265 To apply the patch, copy the file to your root Drupal folder.
266 Then follow the instructions at: http://drupal.org/patch/apply
267
268 ----
269 2.1.1 multiple_node_access.patch
270
271 NOTE: The multiple node access patch has been deprecated.
272 This patch was rejected for Drupal core for version 7. The new database
273 layer makes it unnecessary.
274
275 If you wish to use Domain Access with another node access
276 module, try using the Domain Advanced module.
277
278 http://drupal.org/project/domain_adv
279
280 Original documentation is below:
281
282 You should apply this patch only if you use Domain Access along with
283 another Node Access module, such as Organic Groups (OG), and
284 have need of advanced access controls.
285
286 The multiple_node_access.patch allows Drupal to run more than one
287 node access control scheme in parallel. Instead of using OR logic to
288 determine node access, this patch uses subselects to enable AND logic
289 for multiple node access rules.
290
291 WARNING: This patch uses subselect statements and requires pgSQL or
292 MySQL 4.1 or higher.
293
294 Developers: see http://drupal.org/node/191375 for more information.
295
296 ----
297 2.2 Server Configuration
298
299 For the module to work correctly, the DNS record of your server must accept
300 multiple DNS entries pointing at a single IP address that hosts your Drupal
301 installation.
302
303 The two basic methods for doing this are either to:
304
305 - Setup WildCard DNS, so that *.example.com resolves to your Drupal site.
306 - Setup VirtualHosts so that one.example.com, two.example.com, etc. all
307 resolve to your Drupal site.
308
309 For example, on my local testing machine, I have VirtualHosts to the following
310 sites setup in httpd.conf:
311
312 - example.com => 127.0.0.1
313 - one.example.com => 127.0.0.1
314 - two.example.com => 127.0.0.1
315 - three.example.com => 127.0.0.1
316
317 It is beyond the scope of this document to explain how to configure your DNS
318 server. For more information, see:
319
320 - http://en.wikipedia.org/wiki/Wildcard_DNS_record
321 - http://en.wikipedia.org/wiki/Virtual_hosting
322
323 After you have enabled multiple DNS entries to resolve to your Drupal
324 installation, you may activate the module and configure its settings.
325
326 No matter how many domains resolve to the same IP, you only need one instance
327 of Drupal's settings.php file. The sites folder should be named 'default' or
328 named for your root domain.
329
330 ----
331 2.3 Creating Domain Records
332
333 After you enable the module, you will have a user interface for registering new
334 domains with your site. For these to work correctly, they must also be
335 configured by your DNS server.
336
337 To be clear: creating a new domain record through this module will not alter
338 the DNS server of your web server.
339
340 ----
341 2.4 Setting DOMAIN_INSTALL_RULE
342
343 This is an advanced instruction, and may be ignored.
344
345 At the top of the domain.module file, you will find this line:
346
347 define('DOMAIN_INSTALL_RULE', TRUE);
348
349 This setting controls the default behavior of the module when installing over
350 an existing installation. If set to TRUE, the Domain Access module will assign
351 all existing nodes to be viewable by your primary domain.
352
353 If you set this value to FALSE, existing content will not be visible on your
354 primary domain unless DOMAIN_SITE_GRANT is set to TRUE.
355
356 For more details, see section 6.
357
358 ----
359 2.5 Setting DOMAIN_SITE_GRANT
360
361 At the top of the domain.module file, you will find this line:
362
363 define('DOMAIN_SITE_GRANT', TRUE);
364
365 This setting controls the default behavior for viewing affiliate content.
366 By design, the Domain Access module allows site administrators to assign
367 content to 'all affiliates.' If this value is set to TRUE, then content
368 assigned to all affiliates can be seen by all users on all current domains.
369
370 On install, setting this value to TRUE will assign all current content to
371 be viewable on all domains.
372
373 Normally, you will not need to edit this value.
374
375 ----
376 2.6 Setting DOMAIN_ASSIGN_USERS
377
378 At the top of the domain.module file, you will find this line:
379
380 define('DOMAIN_ASSIGN_USERS', TRUE);
381
382 After you install the Domain Access module, all new users who
383 register will automatically be assign to the domain from which
384 their account was created. This value is used to determine
385 advanced editing access and can be used by modules such as
386 Domain Strict.
387
388 On install, setting this value to TRUE will assign all current users
389 to be members of the default domain. Set the value to FALSE
390 and the module will not assign users to any domains.
391
392 Normally, you will not need to edit this value.
393
394 After installation and configuration, users with the appropriate
395 permissions may batch assign users to domains from
396 Administer > User Management > Users.
397
398 ----
399 3. Permissions
400
401 After enabling the module, go to Access Control to configure the module's
402 permissions.
403
404 ----
405 3.1 Module Permissions
406
407 The Domain Access module has the following permissions:
408
409 - 'administer domains'
410 This permission allows users to create and manage domain records
411 and settings.
412
413 - 'access inactive domains'
414 This permission allows users to navigate to domains which are marked
415 as inactive. Users with this permission may also assign content to an
416 inactive domain.
417
418 'assign domain editors'
419 This permission allows users to assign themselves and other users as
420 affiliate editors. For those users to act as editors, their role(s) must also
421 have the 'edit domain nodes' permission.
422
423 - 'edit domain nodes'
424 This permission is for advanced use and substitutes for the normal
425 'administer nodes' permission for sites that give restricted administrative
426 privileges. See section 3.3 for more information.
427
428 - 'delete domain nodes'
429 This permission is for advanced use and substitutes for the normal
430 'administer nodes' permission for sites that give restricted administrative
431 privileges. See section 3.3 for more information.
432
433 - 'set domain access'
434 This permission is key. Users with this permission will be given a user
435 interface for assigning users and nodes to specific domains. Users without
436 this permission cannot assign domain access; their nodes will automatically
437 be assigned to the currently active domain.
438
439 For example, if a user has this permission and creates a book page on
440 one.example.com, the user will be given a series of options to assign that
441 book page to any or all of the registered domains on the site.
442
443 If the user does not have this permission, the book page will only be shown
444 to users who are on http://one.example.com.
445
446 - 'publish from default domain'
447 - 'publish from assigned domain'
448 - 'publish to any assigned domain'
449 This group of permission provides a limited set of options for users to create
450 and edit content on your site. Users who have this permission will have their
451 node editing forms processed according to the following rules:
452
453 -- 'publish from default domain'
454 Before being presented the editing form, users will be taken to the root
455 domain. If the node is not visible on the root domain, the user may not be
456 able to edit the node.
457
458 -- 'publish from assigned domain'
459 Before being presented the editing form, users will be taken to the
460 first domain assigned to their user account. This function is most useful
461 when you users are only allowed to enter content from a single domain.
462
463 Note that for users who have more than one assigned domain, this option
464 will take them to the first match and the user will not be allowed to
465 change the domain affiliation.
466
467 The advantage of this option is the user cannot modify the URL of a
468 content edit form to match the URL of other domains, forcing all of her
469 posts to be made to a single domain. Users trying to enter content
470 from another domain will always be transferred to their assigned domain.
471
472 In effect, a user assigned to 'one.example.com' will only be able to post
473 to that domain, even if she clicks Create Content from two.example.com.
474
475 -- 'publish to any assigned domain'
476 The node editing form is shown normally, and the user is presented a
477 list of checkboxes or a multiple select list. These options represent the
478 affiliate domains that the user is allowed to publish content to, according
479 to the domains assigned to their user account.
480
481 Note that if this option is selected, users will also be shown a list of
482 affiliates to which the node is assigned. This list shows only the
483 affiliates that the user cannot edit.
484
485 Warning: If this option is selected and the user has no domain publishing
486 options, the user will not be allowed to post or edit!
487
488 NOTE: Users who are assgined _none_ of these permissions and cannot
489 'set domain access' will have the default form values passed as hidden fields.
490 This is the default option. It will assign all content to the domain from
491 which the form is entered.
492
493 Note also that the user is not given the ability to promote content to
494 'all affiliates'. Users who need this ability should be given the 'set domain
495 access' permission instead.
496
497 This feature was added in response to http://drupal.org/node/188275.
498
499 ----
500 3.2 Normal Usage
501
502 Under a normal Drupal site, a single administrator (or a handful of equally
503 trusted administrators) typically have the 'administer nodes' permission and
504 individual 'edit TYPE nodes' permissions.
505
506 The only choices for permissions would be who gets to administer the module
507 settings and who gets to assign nodes to specific domains. Generally, only
508 users who you trust to 'administer site configuration' should be given the
509 'administer domains' permission. As for 'set domain access,' that can be given
510 to any user you trust to use the UI properly.
511
512 ----
513 3.3 Advanced Usage
514
515 In the event that you wish to segregate which content certain editors can
516 control, you should not use the normal 'edit any TYPE nodes' and 'delete any
517 TYPE nodes' permissions provided by Drupal's core Node module.
518 These permissons grant the ability for a user to edit and delete all nodes of a
519 given type.
520
521 In the Domain Access model, these permissions are not used in favor of the
522 provided 'edit domain nodes' and 'delete domain nodes' permissions. These
523 permissions allow editors only to edit (and delete) nodes that belong to their
524 domain.
525
526 To enable this feature, you should grant the 'edit domain nodes' and
527 (optionally) the 'delete domain nodes' permission to some roles. Then assign
528 individual users accounts to specific domains to assign them as Domain Editors.
529
530 NOTE: Users with the 'delete domain nodes' permission must also be given
531 the 'edit domain nodes' permission in order to delete content.
532
533 ----
534 3.4 Limitations
535
536 Due to the way node_access() works, the following limitations should be noted.
537
538 - Any node that is assigned to more than one domain can be edited
539 by any editor who belongs to one of the domains.
540
541 - Users who look at the sites and have the 'administer nodes' permission
542 can always see all content on all sites, which can be confusing. To
543 enforce Domain Access rules on these users, you may enable the
544 'Enforce rules on administrators' setting described in 4.3.3.
545
546 - Users who have the 'edit any TYPE nodes' permission will be able to edit
547 nodes that do not belong to their domain.
548
549 These limitations are due to the permissive nature of node_access(). If any
550 access rule grants you permission, it cannot be taken away.
551
552 ----
553 4. Module Configuration
554
555 The settings for Domain Access are listed under Site Building. The path is
556 'admin/build/domain'.
557
558 ----
559 4.1 Default Domain Settings
560
561 These elements define the 'primary' domain for your site. In the event that a
562 user tries to access an invalid domain, this domain will be used.
563
564 ----
565 4.1.1 Primary Domain Name
566
567 The primary domain for your site. Typically example.com or www.example.com.
568 Do not use http or slashes. This domain will be used as the default URL for your
569 site. If an invalid domain is requested, users will be sent to the primary
570 domain.
571
572 Enter the primary domain for your site here. Typically, you will also enter
573 this value into settings.php for cookie handling. Do not use http:// or a
574 trailing slash when entering this value.
575
576 NOTE: If you have installed Drupal in a subfolder, such as
577 http://example.com/drupal you should not include the folder path
578 as part of the primary domain. Simply use example.com -- Drupal
579 will automatically detect the presence of the subfolder.
580
581 NOTE: As of 5.x.1.5 and higher, you may use a port protocol as part
582 of any domain. So you could set example.com:8080 as the primary
583 domain name. Note that port protocols will not be stripped, so that
584 example.com and example.com:8080 are two separate domains.
585
586 ----
587 4.1.2 Site Name
588
589 This value is taken from your system settings and need not be changed. It is
590 provided to allow readbility in the domain list.
591
592 ----
593 4.1.3 Domain URL Scheme
594
595 Allows the site to use 'http' or 'https' as the URL scheme. Default is
596 'http'. All links and redirects to root site will use the selected scheme.
597
598 ----
599 4.2 Creating domain records
600
601 As noted above, this screen does not register DNS records with Apache.
602
603 Use this screen to register new allowed domains with your site. This
604 process is especially important for sites using Wildcard DNS, as it prevents
605 non-registered sites from resolving.
606
607 Note that as of 6.x.2.0, two domains are created for you on installation.
608 The first is a placeholder for your default domain. The second is a
609 sample domain record.
610
611 The first domain will use the HTTP_HOST value of the request made
612 when installing the module. This value may be edited by going to
613 Admin > Build > Domains and editing the Primary Domain value.
614
615 The second domain will be given the value test.example.com, where
616 example.com is the Primary Domain value. This domain is set to be
617 'inactive' initially. You will need to edit this domain record in order to
618 use it.
619
620 When you create a new domain record, simply fill in the form:
621
622 - Domain
623 This is the full path.example.com, without http:// or a trailing slash.
624
625 - Site name
626 This is the name of the site that will be shown when users access this site.
627
628 -- Domain URL scheme
629 Allows the domain to use 'http' or 'https' as the URL scheme. Default is
630 'http'. All links and redirects to the domain will use the selected scheme.
631
632 -- Domain status
633 By default, all domains are Active and anyone can navigate to them. Setting
634 a domain to Inactive restricts access to users with the 'access inactive
635 domains' permission. This feature is useful for staging content and testing
636 new domain configurations.
637
638 NOTE: Users who try to access an inactive domain will have the attempt
639 reported in the site logs. When this occurs, the module will try to redirect
640 the user to the appropriate content on an active domain. If no match is
641 found, the user is send to the default home page.
642
643 Both the Domain and the Site name are required to be unique values.
644
645 After you create a record, you may edit or delete it as you see fit.
646
647 NOTE: As a result of module installation, you will never have a Domain with
648 the domain_id of 1 if you did not use Domain Access prior to 6.x.2.0. This
649 is by design and will not affect the module.
650
651 NOTE: When editing a domain record, Domain Access runs an http request
652 to see if the domain is responding properly. This test checks for the presence
653 of the file '200.png' inside the module's 'test' directory.
654
655 If a 200 "found" reply is not returned, you will see an message warning you
656 that your DNS may not be configured properly. This message is intended
657 to help you debug your DNS configuration and may be safely ignored.
658
659 NOTE: Users who attempt to access an unregistered domain will be
660 redirected to the primary domain automatically.
661
662
663 ----
664 4.3 Domain Module Behaviors
665
666 These options affect the basic options for how the module behaves.
667
668 ----
669 4.3.1 New Content Settings
670
671 Defines the default behavior for content added to your site. By design, the
672 module automatically assigns all content to the currently active domain.
673 If this value is set to 'Show on all sites,' then all new content will be
674 assigned to all sites _in addition to_ the active domain.
675
676 If you set this value to 'Only show on selected sites,' you must configure
677 the Node type settings described in section 4.8.2.
678
679 ----
680 4.3.2 Debugging Status
681
682 If enabled, this will append node access information to the bottom of each
683 node. This data is only viewable by uses with the 'set domain access'
684 privilege. It is provided for debugging, since 'adminiseter nodes' will make
685 all nodes viewable to some users.
686
687 ----
688 4.3.3 Enforce Rules on Administrators
689
690 When using Node Access modules, user 1 (the super-admin) and users with
691 the 'administer nodes' permission are not subject to node access rules. This
692 is a design feature of Drupal, and it can lead to confusion when viewing your
693 site as an administrator.
694
695 To help with this confusion, the 'Enfore rules on adminstrators' setting can
696 be enabled. This setting forces Domain Access rules to be applied _even to
697 users who can administer nodes_.
698
699 The default setting is OFF, but if you regularly login as user 1 or a user with
700 the 'administer nodes' permission, you may want to enable this feature.
701
702 NOTE: This feature _only_ applies Domain Access rules. if you are using
703 multiple node access modules, not all rules will be applied.
704
705 ----
706 4.3.4 Sort Domain Lists
707
708 Both the Domain Switcher block and the Domain Nav module provide an
709 end-user visible list of domains. The domain sorting settings control how
710 these lists are generated and presented to the user.
711
712 ----
713 4.3.5 Domain Selection Format
714
715 Controls the form element display when choosing a list of domains. By
716 default, Domain Access shows checkboxes, but if your site has a large
717 number of domains, checkboxes hinder usability. You may use this setting
718 to force domain lists to be displayed as multiple select lists instead.
719
720 By default, if you have more than 25 domains, a select list will be used
721 for your forms, but you may use this setting to alter that behavior.
722
723 ----
724 4.4 Advanced Settings
725
726 These settings control advanced features for the module. Some of these
727 features require patches to Drupal core. Please read the documentation
728 carefully before implementing these features.
729
730 NOTE: Some of these options may be disabled in the event that patches
731 have not been applied.
732
733 By default, these features are all disabled.
734
735 ----
736 4.4.1 Search Settings
737
738 Allows the admin to decide if content searches should be run across all
739 affiliates or just the currently active domain. By design, Drupal will only
740 find matches for the current domain.
741
742 ----
743 4.4.2 Search Engine Optimization
744
745 There is a risk with these modules that your site could be penalized by search
746 engines such as Google for having duplicate content. This setting controls the
747 behavior of URLs written for nodes on your affiliated sites.
748
749 - If SEO settings are turned on, all node links are rewritten as absolute
750 URLs.
751 - If assigned to 'all affiliates' the node link goes to the 'default source
752 domain' defined in 4.4.3. Normally. this is your primary domain.
753 - If assigned to a single affiliate, the node link goes to that affiliate.
754 - If assigned to multiple affiliates, the node link goes to the first
755 matching domain.
756 (Determined by the order in which domains were created, with your primary
757 domain matched first.)
758
759 The optional Domain Source module (included in the download) allows you to
760 assign the link to specific domains.
761
762 ----
763 4.4.3 Default Source Domain
764
765 This setting allows you to control the domain to use when rewriting links that
766 are sent to 'all affiliates.' Simply select the domain that you wish to use as
767 the primary domain for URL rewrites.
768
769 NOTE: This option only fires if you enable SEO rewrites or use the provided
770 Domain Source module.
771
772 By default this value is your primary domain.
773
774 ----
775 4.4.4 WWW Prefix Handling
776
777 This setting controls how requests to www.example.com are treated with
778 respect to example.com. The default behavior is to process all host names
779 against the registered domain list.
780
781 If you set this value to 'Treat www.*.example.com as an
782 alias of *.example.com' then all host requests will have the 'www.' string
783 stripped before the domain lookup is processed.
784
785 Users going to a www.one.example.com in this case will not automatically
786 be sent to one.example.com, but your Drupal site will behave as if they
787 had requested one.example.com.
788
789 This feature was requested by Rick and Matt at DZone.com
790
791 ----
792 4.4.5 Node Access Settings
793
794 This setting controls how you want Domain Access to interact with other
795 node access modules.
796
797 If you _are not_ using a module such as Organic Groups or Taxonomy
798 Access Control, this setting may be disabled. This setting is only
799 required IF:
800
801 -- You are using more than one node access control module.
802 -- You want to strictly enforce access permissions by requiring
803 both Domain Access and your other module to grant permission.
804
805
806 By design, the node access system in Drupal 5 is a permissive system.
807 That is, if you are using multiple node access modules, the permissions
808 are checked using an OR syntax.
809
810 As a result, if any node access module grants access to a node, the user
811 is granted access.
812
813 The included multiple_node_access.patch (discussed in 2.1.1) alters this
814 behavior. The patch allows Drupal to use AND logic when running more
815 than one node access module.
816
817 For example, when using OG and DA, Drupal's default behavior is:
818
819 -- Return TRUE if OG is TRUE -or- DA is TRUE.
820
821 This patch allows you to enforce the rule as:
822
823 -- Return TRUE if OG is TRUE -and- DA is TRUE.
824
825 By design, the default behavior is to use Drupal's OR logic.
826
827 For more information, see http://drupal.org/node/191375.
828
829 Enabling this feature requires the multiple_node_access patch discussed
830 in 2.1.1.
831
832 ----
833 4.5 Special Page Requests
834
835 For this feature to work, you must follow the instructions in INSTALL.txt
836 regarding custom_url_rewrite_outbound(). If you have not followed the
837 instructions, you should see a warning at the top of the Admin > Build > Domains
838 page.
839
840 In normal uses, such as the default home page, you want to restrict access
841 to content based on the active domain. However, in certain cases, this
842 behavior is not desired.
843
844 Take the Track page for each user, for example. The Track page is at
845 'user/UID/track' and shows a list of all posts by that user. By design, this
846 page may show different results if seen from different domains:
847
848 -- one.example.com/user/1/track
849 Shows all posts by user 1 assigned to the domain one.example.com
850
851 -- two.example.com/user/1/track
852 Shows all posts by user 1 assigned to the domain two.example.com
853
854 The behavior we really want is to show ALL posts by the user regardless of
855 the active domain.
856
857 The Special Page Requests setting lets you specify Drupal paths for which
858 this behavior is active. These paths are entered in the same way as block
859 settings for page visibility.
860
861 Some sample pages that might require this setting. Note, some of these
862 are contributed modules:
863
864 -- user/*/track
865 -- blog/* -- the user blog page
866 -- mysite/* -- the MySite module
867 -- popular/alltime -- a View page
868 -- popular/latest -- a View page
869 -- taxonomy/term/* -- to show all taxonomy terms at all times
870 -- taxonomy/term/10 -- to show only term 10 at all times
871 -- taxonomy/term/*/feed/* -- all taxonomy term feeds
872
873 Default and custom Views are often good candidates here as well.
874
875 By default, 'user/*/track' is in this list.
876
877 The logic for how these links are written is documented in 4.4.2 Search Engine
878 Optimization.
879
880 Note that the 'search' path is handled separately and need not be added here.
881
882 ----
883 4.5.1 Cron Handling
884
885 When Drupal's cron function runs, it runs on a specific domain. This forces
886 Domain Access to invoke its access control rules, which may not be desired.
887
888 In most use cases, you will want Domain Access to allow access to all nodes
889 during cron runs. For modules such as Subscriptions, this behavior is
890 required unless all your content is assigned to "all affiliates."
891
892 To reflect this, Domain Access provides a configuration option labelled:
893
894 [x] Treat cron.php as a special page request
895
896 This option is turned on by default. In almost all cases, you should leave
897 this option checked. Doing so allows Domain Access to ignore access checks
898 for nodes when cron runs.
899
900 Note that this does not affect node access permissions set by other modules.
901
902 ----
903 4.6 Node Link Patterns
904
905 When using this module, there are times when Domain Access will need to
906 rewrite a node link using custom_url_rewrite_outbound().
907
908 Since Drupal is an extensible system, we cannot account for all possible
909 links to specific nodes. Node Link Patterns are designed to allow you to
910 extend the module as you add new contributed modules.
911
912 By default, the following core link paths will be rewritten as needed.
913
914 -- node/%n
915 -- comment/reply/%n
916 -- node/add/book/parent/%n
917 -- book/export/html/%n
918 -- node/%n/outline
919
920 Where %n is a placeholder for the node id.
921
922 If you install additional modules such as Forward
923 (http://drupal.org/project/forward)
924 or Print
925 (http://drupal.org/project/print)
926 you will want to add their paths to this list:
927
928 -- forward/%n
929 -- print/%n
930
931 This is an advanced, but necessary feature. Please report any core node path
932 omissions at http://drupal.org/project/issues/domain.
933
934 ----
935 4.7 Domain List
936
937 This screen shows all active domains registered for use with the site.
938
939 Record zero (0) is hardcoded to refer to the "root" site defined as your
940 Primary domain name.
941
942 ----
943 4.8 Node Settings
944
945 The Node settings page is divided into two parts, each with a different purpose.
946
947 ----
948 4.8.1 Domain Node Editing
949
950 The top section 'Domain node editing' is required for those sites that use the
951 advanced editing techniques outlined in section 3.
952
953 For users without the 'administer nodes' permission, certain elements of the
954 node editing form are hidden. These settings allow the site administrator to
955 enable users with the 'edit domain nodes' permission to have access to those
956 restricted fields.
957
958 By default, 'Comment settings', 'Delete node', 'Publshing options', and 'Path
959 aliasing' are enabled.
960
961 ----
962 4.8.2 Domain Node Types
963
964 The lower section 'Domain node types' is used to extend the 'New content
965 settings' described in 4.1.
966
967 Domain node types presents a list of all active node types on your site. By
968 checking the box, nodes for that given type will automatically be assigned to
969 'all affiliate sites' during node creation and editing.
970
971 ----
972 4.9 Batch Updating
973
974 The module provides for batch actions for common tasks. These actions are
975 useful for making rapid changes across all domains. The following actions
976 are available by default.
977
978 - Edit all domain values
979 - Edit all site names
980 - Edit all URL schemes
981 - Edit all domain status flags
982
983 Additional batch actions are made available for the Domain Configuration
984 module. Other modules may implement hook_domainbatch() to provide
985 additional batch actions.
986
987 It may be necessary to enter the batch form from the primary domain.
988
989 For some settings, you may see an 'Update value for all domains' section
990 of the form. You may use this value to reset all domains to the same
991 setting. This option is not available for settings that must be unique
992 per domain, such as the domain string.
993
994 For global settings to apply, you must check the 'Apply to all domains'
995 box before submitting the form.
996
997 ----
998 4.10 Assigning Users to Domains
999
1000 New in 6.x.2 is the concept of 'user defaults.' These settings are used to
1001 assign users to domains basd on the user's site roles.
1002
1003 Click on the 'User defaults' tab to see the settings available.
1004
1005 By design, these settings are always added to a user's domains when a page
1006 is requested. That is, if you assign all 'authenticated users' to your first
1007 domain, one.example.com, then all authenticated users will be assigned to that
1008 domain.
1009
1010 This setting is most useful under the following conditions:
1011
1012 -- If you let anonymous users post content on your site. In this case, you
1013 should assign at least one domain to the anonymous user role, so that
1014 the module will assign anonymous posts to the appropirate domain(s).
1015
1016 -- If you use Domain Strict, you can use this setting to assign default
1017 access to specific roles.
1018
1019 Note that there are two options for how this setting behaves:
1020
1021 -- Add default roles dynamically [default]
1022 This setting is the normal use and does not write individual records to the
1023 {domain_editor} table. Use this setting if you want to change options for
1024 each role quickly, as these are global settings, so taking away a domain
1025 will instantly apply to all users.
1026
1027 -- Add default roles to the user account
1028 Use this setting if you want to automatically register users to specific
1029 domains or to save changes to a batch of users. When this setting is
1030 active, domain assignments are saved permanently to the {domain_editor}
1031 table and can only be removed by editing the user account.
1032
1033 You may also assign default domains for all new users of your site. To do
1034 so, simply select the domains that new users should be assigned to. If you
1035 make no selection, new users will automatically be assigned to the domain
1036 from which they enter the registration form.
1037
1038 Settings for the 'new user' are permanently saved to the user account.
1039
1040 See http://drupal.org/node/313629 for some background about this feature.
1041
1042 ----
1043 4.11 Batch Assignment of Users to Domains
1044
1045 In 6.x.2 and higher, users with the 'administer users' and 'assign domain
1046 editors' permissions may use the User administration page to batch assign
1047 users to domains.
1048
1049 This feature is useful if you need to convert a group of editorial users to
1050 become domain editors.
1051
1052 To use this feature, navigate to Administer > User management > Users.
1053 Look for the 'Assign users to domains' option in the 'Update options' select
1054 form. Choose this operation and then use the 'Affiliate editor options'
1055 fieldset to select the domains you wish to assgin users to.
1056
1057 Select the desired users and hit the Update button.
1058
1059 Note that this form also shows you a list of domains that a user is
1060 currently assigned to.
1061
1062 If these elements do not appear, you do not have the proper permissions.
1063
1064 ----
1065 5. Blocks
1066
1067 The Domain Access module provides two blocks, which can be used to help you
1068 debug your use of the module.
1069
1070 ----
1071 5.1 Block -- Domain Switcher
1072
1073 The Domain Switcher block presents a list of all active domains. Clicking
1074 on one of the links will take you from your current URL to the same URL on
1075 the selected domain.
1076
1077 For example, if you are looking at example.com/?q=node and click on another
1078 domain, the link will take you to one.example.com/?q=node.
1079
1080 In the Domain Switcher block, domains are listed using their human-readable
1081 sitename variables.
1082
1083 NOTE: This block is for debugging purposes. The included Domain Navigation
1084 module provides block and menu items intended for end users.
1085
1086 ----
1087 5.2 Block -- Domain Access Information
1088
1089 The Domain Access Information block lets you view node access rules for any
1090 node when you are viewing that node. This block can help you debug the
1091 module for user accounts that do not have the 'set domain access' permission.
1092
1093 NOTE: By design, this block is viewable by all users. However, its content
1094 should only be shown to site developers or during debugging. You should use
1095 the normal block visiblity settings as appropriate to your site.
1096
1097 ----
1098 6. Node Access
1099
1100 The Domain Access module is a node_access() module. For additional developer
1101 information, see http://api.drupal.org/api/group/node_access/5.
1102
1103 By design, the module sets access to content based on the current domain that
1104 a user is viewing. If a user is at one.example.com, they can see content that
1105 is assigned to that domain or to all domains.
1106
1107 ----
1108 6.1 Assigning Domain Access
1109
1110 Users who have the 'set domain access' permission can assign any node to any or
1111 all registered sites. During node editing, a series of options will be
1112 displayed as checkboxes or a multiple select list under the heading
1113 "Domain access options":
1114
1115 Publishing options:
1116 [] Send to all affiliates
1117 Select if this content can be shown to all affiliates. This setting will
1118 override the options below.
1119
1120 Publish to: * (required)
1121 [] Drupal
1122 [] One site
1123 [] Two site
1124 Select which affiliates can access this content.
1125
1126 If you select 'Send to all affiliates,' the node will be viewable on all domains
1127 for your site. Even if you select this option, you must select at least one
1128 domain for the node.
1129
1130 If you do not select at least one option, the module will automatically
1131 assign the node to your default domain.
1132
1133 When creating new content, the currently active domain will be selected for you.
1134
1135 For users who do not have the 'set domain access' permission, the assignment
1136 will be done through a hidden form element. The node will be assigned to the
1137 currently active domain or, if configured , to all domains.
1138
1139 ----
1140 6.2. Editor Access
1141
1142 Whenever a user account is created and the Domain Access module is active, user
1143 accounts will automatically be tagged with the name of the active domain from
1144 which they registered their account. Users with the 'set domain access'
1145 permission may assign individual users to specific domains in the same way that
1146 nodes can be defined.
1147
1148 These user settings are used to determine what domains an editor belongs to.
1149 Users with the 'edit domain nodes' permission can edit any node that belongs to
1150 the same domain that the user does. (Remember that users and nodes can both
1151 belong to multiple domains.) However, nodes that are assigned to 'all
1152 affiliates' do not grant editing privileges to all editors.
1153
1154 ----
1155 6.3 Realms
1156
1157 This section contains technical details about Drupal's node access system.
1158
1159 In Domain Access, the following realms are defined:
1160
1161 - domain_all
1162 Indicates whether the view grant should be passed for all nodes on
1163 a given page request. Used in cases such as Search and MySite to
1164 enable aggregation of content across affiliates. The only valid nid
1165 and gid for this grant are zero (0).
1166
1167 - domain_site
1168 Indicates whether a node is assigned to all affliaites. The only valid
1169 grant id for this realm is zero (0).
1170
1171 - domain_id
1172 Indicates that a node belongs to one or more registered domains. The
1173 domain_id key is taken from the {domain} table and is unique.
1174
1175 ----
1176 6.4 Grants
1177
1178 In each of the realms, there are specific rules for node access grants, as
1179 follows.
1180
1181 - domain_all
1182 In some specific cases, like Search, or MySite, or the user's Tracker page
1183 we want people to be able to see content across all affiliates. Only the
1184 domain_all grant is assigned in these cases. This grants only 'grant_view'.
1185
1186 - domain_site
1187 By design, all site users, including anonymous users, are granted access to
1188 the gid '0' for realm 'domain_site'. This grant allows all users to see
1189 content assigned to 'all affliates'. This grants 'grant_view' to all users.
1190 Users who belong to the current domain and are assigned the
1191 'edit domain nodes' or 'delete domain nodes' permissions will be given
1192 'update' and 'delete' grants, respectively.
1193
1194 - domain_id
1195 When a user, including anonymous users, views a page, the active domain is
1196 identified by the registered domain_id. For that page view, the user is
1197 granted gid of the active domain_id for the realm 'domain_id'. This allows
1198 content to be partitioned to one or many affilaites. This grants only
1199 'grant_view', since 'grant_edit' would allow content to appear to some users
1200 regardless of the active domain.
1201
1202 ----
1203 6.5 Warnings
1204
1205 Node access in Drupal is a permissive system. Once a grant has been issued, it
1206 cannot be revoked. As a result, it is possible for multiple editors to be able
1207 to edit or delete a single node. Here's the use case:
1208
1209 - Node 10 (a book page) is assigned to one.example.com and three.example.com
1210 - User A is an editor for one.example.com.
1211 - User B is an editor for two.example.com
1212 - User C is an editor for three.example.com
1213
1214 Under this scenario, User A and User C will be able to edit node 10.
1215
1216 To be more clear about Drupal permissions:
1217
1218 - User D has 'administer nodes' permission for the site.
1219 - User E has 'edit book nodes' permission for the site.
1220
1221 In this case, User D and User E can also edit or delete node 10. This is why
1222 only super-admins are given 'administer nodes' and 'edit TYPE nodes'
1223 permissions with the Domain Access module. If you want your affiliate editors
1224 to have limited permissions, only grant them 'edit domain nodes'.
1225
1226 However, you still need to give users the 'create TYPE nodes' permission
1227 normally. Domain Access does not affect node creation.
1228
1229 Since Domain Access implements node_access() fully, if you uninstall the module
1230 -- using Drupal's uninstall sequence -- all node_access entries should be reset
1231 to grant 'grant_view' to realm 'all' with gid '0'.
1232
1233 ----
1234 7. Developer Notes
1235
1236 The Domain Access module is meant to be the core module for a system of small
1237 modules which add functionality.
1238
1239 ----
1240 7.1 Extension Modules
1241
1242 Currently, the following modules are included in the download. They are not
1243 required, but each adds functionality to the core module.
1244
1245 - Domain Alias -- Allows advanced handling of domain name matching. Use
1246 this module to treat multiple domains as though they were identical.
1247
1248 - Domain Configuration -- Allows you to change select system variables for
1249 each domain, such as offline status, footer message and default home
1250 page.
1251
1252 - Domain Content -- Provides a content administration page for each domain,
1253 so that affiliate editors can administer content for their section of the
1254 site.
1255
1256 - Domain Navigation -- Supplies a navigation block with three themes. Creates
1257 menu items for each domain, suitable for using as primary or secondary
1258 links.
1259
1260 - Domain Prefix -- A powerful module that allows for selective table prefixing
1261 for each domain in your installation.
1262
1263 - Domain Source -- Allows editors to specify a primary "source" domain to be
1264 used when linking to content from another domain.
1265
1266 - Domain Strict -- Forces users to be assigned to a domain in order to view
1267 content on that domain. Note that anonymous users may only see content
1268 assigned to "all affiliates" if this module is enabled.
1269
1270 - Domain Theme -- Allows separate themes for each domain.
1271
1272 - Domain User -- Allows the creation of specific subdomains for each active
1273 site user.
1274
1275 - Domain Views -- Provides a Views filter for the Domain Access module.
1276
1277 ----
1278 7.2 The $_domain Global
1279
1280 During hook_init(), the Domain Access module creates a nwe global variable,
1281 $_domain, which can be used by other Drupal elements (themes, blocks, modules).
1282
1283 The $_domain global is an array of data taken from the {domain} table for the
1284 currently active domain. If no active domain is found, default values are used:
1285
1286 $_domain['domain_id'] = 0;
1287 $_domain['sitename'] = variable_get('domain_sitename',
1288 variable_get('site_name', 'Drupal'))
1289 $_domain['subdomain'] = variable_get('domain_root', '')
1290 $_domain['scheme'] = 'http'
1291 $_domain['valid'] = TRUE
1292 $_domain['path'] = http://example.com
1293 $_domain['error'] = ''
1294
1295 Some uses for this global variable might include:
1296
1297 - Block placement based on active domain (using PHP for block visibility).
1298 - Ad tags inserted based on active domain.
1299 - Theme switching based on domain.
1300
1301 The 'error' element is new in 6.x.2 and is used to signal installation problems.
1302 Normally the 'error' element should not be set. See the API documentation of
1303 hook_domain_bootstrap_ful() for details.
1304
1305 ----
1306 7.3 Database Schema
1307
1308 The Domain Access module creates two tables in a Drupal installation. {domain}
1309 contains the following structure:
1310
1311 - domain_id
1312 Integer, unique, auto-incrementing.
1313 The primary key for all domain records.
1314
1315 - subdomain
1316 Varchar, 80, unique (enforced by code)
1317 'Domain' is a sql-reserved word, so subdomain is used. This value must match
1318 the url 'host' string derived from parse_url() on the current page request.
1319
1320 - sitename
1321 Varchar, 80, unique (enforced by code)
1322 The name for this affiliate, used for readability.
1323
1324 - scheme
1325 Varchar, 8 default 'http'
1326 Indicates the URL scheme to use when accessing this domain. Allowed values,
1327 are currently 'http' and 'https'.
1328
1329 - valid
1330 Char, 1 default 1
1331 Indicates that this domain is active and can be accessed by site users.
1332
1333 The {domain_access} table is a partial mirror of the {node_access} table and
1334 stores information specific to Domain Access. Its structure is:
1335
1336 - nid
1337 Integer, unsigned NOT NULL default '0,
1338
1339 - gid
1340 Integer, unsigned NOT NULL default '0'
1341
1342 - realm
1343 Varchar, 255 NOT NULL default ''
1344
1345 The {domain_editor} table stores information about which users can edit and
1346 delete content on specific domains. Its structure is:
1347
1348 - uid
1349 Integer, unsigned NOT NULL default '0,
1350 A foreign key to the {users} table.
1351
1352 - domain_id
1353 Integer, unsigned NOT NULL default '0'
1354 A foreign key to the {domain} table.
1355 ----
1356 7.4 API
1357
1358 The Domain Access module has an API for internal module hooks. Documentation is
1359 included in the download as API.php and can be viewed online at:
1360
1361 http://therickards.com/api
1362
1363 The most important developer functions are the internal module hooks:
1364
1365 http://therickards.com/api/group/hooks/Domain
1366
1367 ----
1368 7.5 drush and Domain Access
1369
1370 Using drush, treat a Domain Access site like a multi-site install. If you do not supply
1371 a URI flag, drush gets confused and will error out.
1372
1373 Enter drush commands in the format:
1374
1375 >> drush --uri=www.example.com NORMAL COMMAND
1376
1377 Generally, use the primary domain as the --uri flag.
1378
1379 ----
1380 7.6 Domain Tokens
1381
1382 The module provides the following replacement tokens.
1383
1384 'domain-id'
1385 The current domain ID.
1386 'domain-name'
1387 The current domain name, lowercased and with only alphanumeric characters.
1388 'domain-name-raw'
1389 The current domain name. WARNING - raw user input. NOT path safe.
1390 'domain-url'
1391 The current domain\'s URL, lowercased and with only alphanumeric characters.
1392 'domain-url-raw'
1393 The current domain\'s URL. WARNING - raw user input. NOT path safe.
1394 'domain-subdomain'
1395 The current subdomain, lowercased and with only alphanumeric characters.
1396 Only works with *.example.com formats
1397 'domain-subdomain-raw'
1398 The current subdomain. Only works with *.example.com formats. WARNING - raw
1399 user input. NOT path safe.
1400 'domain-default-id'
1401 The default domain ID.
1402 'domain-default-name'
1403 The default domain name, lowercased and with only alphanumeric characters.
1404 'domain-default-name-raw'
1405 The default domain name. WARNING - raw user input. NOT path safe.
1406 'domain-default-url'
1407 The default domain\'s URL, lowercased and with only alphanumeric characters.
1408 'domain-default-url-raw'
1409 The default domain\'s URL. WARNING - raw user input. NOT path safe.

  ViewVC Help
Powered by ViewVC 1.1.2