Administrators Notes

The following pages will list tips and information for administrators. Some pages are part of the protected organic group (hence all STAR users will be able to see and read) and some are strictly reserved for administrators and will be invisible.

Comment module

The comment module was set on purpose as follow

  • Comments are not visible by anonymous users (access comment should not be enabled for this categorY0. This allows to provide meeting notes in comment form without anyone not in STAR seeing it (action items, plans etc...) but sometimes, still see the meeting agenda.
  • Comments were initially subject to approval / moderation. Upon request, this was changed to without moderation for authenticated users.
  • The authenticated generic has been set to be allowed to post comments (and access them) but those will be subject to moderation (admins, see and maintain Note on authorization).

Directory structure

A directory structure of STAR Drupal

Organic groups

  • Physics Working Groups - under /pwg/groupname, e.g. You do not have access to view this node
  • Subsystems - /subsys/subsystemname-group e.g. SSD group
  • Software & Computing - in main directory Software and Computing

Note that subsystems have also their pages that have nothing to do with organic group pages, like SSD.
The same is with "Software & Computing" that has both an OG Software and Computing and another page Software & Computing

Drupal problems and miss-features

Beware that Drupal has several miss-features and bugs as any product. Some may be fixed in later versions and we will enumerate by version to be sure to remove any confusion.

  • Version 4.6
    • Create Content - import images
      From the admin account, this will upload images with several miss-feature and defaults improper for public display. Manua repair is needed thereater to fix this so, use at your own risk (or automate changes in a cron).
      • When importing, the images are first not published and not promoted. To fix this, you need to access the database and use the following command:
        mysq> UPDATE node SET promote=1 WHERE promote=0 AND type='image';
        mysql> UPDATE node SET status=1 WHERE status=0 AND type='image';
      • nodes do not have the proper access protection information which will prevent image sharing. There were no options to fix this in image import. So, two manual steps are needed ; the first command needs to be piped to an external file (let's call it bla.txt)
        mysql> SELECT node.id FROM node LEFT OUTER JOIN node_access ON node.nid=node_access.nid WHERE node_access.nid IS NULL;
        % cat bla.txt | grep '|' | awk '{print "INSERT IGNORE INTO node_access VALUES("$2",0,\"og_group\",1,0,0);"}' >insert.mysql
        mysql> source insert.mysql;
    • administer - settings - filemanager
      The filemanager HTML field Public file system url is terribly miss-leading. What you see in there is NOT what you have set. The best recommendation is to
      • fill all the other field and leave this one empty
      • Click the [Save Configuration] button.
      • Clear the box again and enter something like http://drupal.star.bnl.gov/STAR/files (for a path ending with files)
      • Click the [Save Configuration] button.
      • Verify a previously attached document that it is really recoverable ...

Existing generic accounts

The current generic accounts are in use. Please, extend the list as new accounts are added (hopefully not many).
  • guest: an account used for temporary guest (like members of a review committee). The ACL for this account are lower than any other accounts and uses authenticated generic (which should have a lower access control)
    [this account's Email is registered to J. Lauret]
  • staruser: a generic account for STAR users wanting access to Drupal but without a personal account. This is also used for the conference PC. The ACL for this account are lower than any other accounts and uses authenticated user.
  • protected: a privileged user (usr lead) having the same password than the protected area on STAR Web.

  • stargrid: a privileged account (usr lead) used for managing Grid area Drupal pages. This allows collaborative documentation.
  • starembed: this account is a normal authenticated user created for managing embedding documentation pages. This facilitates collaborative work.

  • stareemc: a generic authenticated user created for the EEMC group to manage their documentation.
  • stardaq: a generic authenticated user created for the DAQ group to manage DAQ documentation.
  • hbtuser: a generic authenticated user created for the HBT PWG OG.
  • heavyuser:a generic authenticated user created for the HF PWG. This account is blocked.

How to do it in Drupal?

Remove a page from $DRUPAL/admin/content/book

How can I remove a book from$DRUPAL/admin/content/book?

Click on the link to the book page you want to remove from this list. Then, click "outline" tab and set a book as a part of the "general" book. Done.

Migrating drupal to a new node

Ideally, Drupal would be installed under a generic alias name. But if this is not done, there are a hand full of places you need to alter for a full migration.

  • Go as Administrator, administer -> settings -> filemanager and change the Public file system url box reference. You should do this before copying to a new server (as db access will not be possible afterward)
  • Log on to your Drupal server as root, cd to the Drupal's root installation directory. Edit sites/default/settings.php and change $base_url
  • Check a file named scripts/cron-curl.csh and change the reference

You should be ready to export Drupal as-is to another server.

Needed theme - a warning

WARNING on theme

The theme named garland should NOT be removed as it is used for basic administration tasks (via garland/minnelli). All the rest can be removed physically without much problems.

Note on authorization

Currentely, we have
  • anonymous user
  • authenticated generic
  • authenticated user
  • authenticated usr lead
  • site admin
The naming was chosen strictly to have it sorted in alpha-order with increasing privilege. It was NOT the intent to have "site admin" administer basic layout of the site (should be reserved to the main admin).
BEWARE that some privileges should NOT be granted to ANY categories but site admins which should by themselves be restricted. Especially:
  • administer nodes allows to bypass all privileges since the node itself is accessible. This includes bypass of OG document access
The following users have site admin privs
  • testadmin
  • chajecki
See also Existing generic accounts.

Organic Group versus regular page

General

Organic group were chosen so far as being PWG groups and key groups in STAR. Later, this may include detector sub-systems. In general. OG will be used to "hide" or group documentation not necessarily accessible by others non-subscribers but its use is more extended as described below.

 

Organic group possibilities

  • Allow grouping post together and keeping tracks of things per groups (each group have separate XML feeds)
  • Allow to customize area via themes. An image could be loaded per Group. Other usage could be developed/thought about. For example, the menu box could be moved up/down by modifying a "weight" for a different template, images included, background picture, watermark used and so on. The limit is your imagination. Drupal provides base theme templates here. But before getting carried way, please consult the Themes page for more information.
  • A group could be globally moved (its entire structure could become the root of anew tree). Porbably not something we want to do ...
  • Subscriptions to a "group" could be handled per group. Options are:
    1. open - subscription requests are accepted immediately
    2. moderated - subscription requests must be approved.
    3. invite only - subscriptions must be created by an administrator.
    Currently, all are opened.
  • A group could be globally managed by a given user
  • A group may contain its own agenda, meeting, polls, blogs etc ... [actually, I think this is an overkill and will probably suppress some when I find how to do that]

 

Site customization

The following modules were site customized or modified.

Theme - bluelake

A template.php was added to display the name of the drupal user who had last updated the page along with the original page author.
This was requested to ease the maintenance of pages maintained by multiple users (when ACLs are set to allow many to all to edit and modify).

The code is as below

function phptemplate_node_submitted($node) {
  // JL - Simplified logic originally taken from https://drupal.org/node/511642
  if ($node->changed ){
    // The node was changed from its original format - good ..
    $revuid = $node->revision_uid;
    if ( $revuid != 0 && $revuid != $node->uid ){
      // Only display this if the revision owner UID differs from the original owner UID
      $revname = db_result(db_query("SELECT name FROM {users} WHERE uid = %d",$revuid));
      # JL - be careful of possible orphans
      if ( empty($revname) ){  $revname = 'unknown';    }
      else {                   $revname = '<a href="'.url("user/$revname").'">'.$revname.'</a>'; }

      return t('Updated on @changed by !newuser. Originally created by !username on @created.',
             array(
                   '@changed'  => format_date($node->changed, 'medium'),
                   '!newuser'  => $revname,
                   '!username' => theme('username', $node),
                   '@created'  => format_date($node->created, 'small'),
                   ));
    } else {
      // No need to show the revised uid as they are the same
      return t('Updated on @changed. Originally created by !username on @created.',
             array(
                   '@changed'  => format_date($node->changed, 'medium'),
                   '!username' => theme('username', $node),
                   '@created'  => format_date($node->created, 'small'),
                   ));
    }

  } else {
    // Return the default formatting
    return t('Submitted by !username on @datetime',
             array(
                   '!username' => theme('username', $node),
                   '@datetime' => format_date($node->created),
                   ));
  }
}

NODE ACCESS patch to maintain OG compatibility

see attached file..

Advanced Poll module has broken CSS for Ranking polls

By default, advpoll-display-ranking-form.tpl.php does not include:

<div style="clear:both"></div>

...so container height is not calculated properly.

Captcha - enable AFS user name lookup

changed file: /var/www/html/STAR/sites/all/modules/captcha/captcha.module

1. added function:

function captcha_validate_star_account_by_afs() {
  if ( $_POST['form_id'] === 'user_register' && !empty( $_POST['captcha_token'] ) ) {
    $dirname = '/afs/rhic.bnl.gov/star/users/'.$_POST['name'];
    return file_exists( $dirname );
  }
  return true;
}

2. modified functions: captcha_validate_strict_equality, captcha_validate_case_insensitive_equality, captcha_validate_ignore_spaces, captcha_validate_case_insensitive_ignore_spaces

 added line:
  if ( captcha_validate_star_account_by_afs() === false ) { return false; }

Useful administrators links

 

Granting access to nodes

.

Granting access to nodes: Is "nodeaccess" module good for STAR?

A. Nodeaccess for administrators:

1. ACLs

  • administer nodeaccess (decide for which node types CA module should be enabled and whether an author of the node can grant permission (view/update/delete) to this node for a specific user
  • grant node permissions (which users can grant node permission for all nodes -  but only for nodes of the type that has CA module enabled)
  • grant own node permission (which users can grant node permission for their own nodes)

2. SETTINGS

2.1. General settings

Administrator can decide which roles should be listed on individual node grants. If for example "anonymous user" role is not selected then a node author cannot grant an access to his/her node for this group.
[Important for STAR]  By settings allowed rules as shown below we are sure that any user that can grant permissions to nodes will not be able to allow anonymous user to edit any nodes.

2.2. Settings for a specific node type.

(here I will use "book" type as an example).

Admin can decide if grant tab should be shown for a spefic node type and can set default access rules for this node type. See below for an example

[Important for STAR] When testing this module I found some problems with admin settings.
Go to "Problems" to get more details.

B. Nodeaccess for users:

An example of how  "grant tab" looks like.

User can grant access for single users as well as roles but only the ones that are enabled in admin settings.

C. Problems and concerns. 

  1. Information about user access granted to specific pages is lost when module settings are updated.
  2. Even if a module doesn't give a node grants priority (set in module settings) when update of the settings is performed the module overrides access grants to all nodes that belong to to other modules like e.g. organic group.
    Real example:
    The following (book) page
    drupal.star.bnl.gov/STAR/pwg/femtoscopy-hbt/papers/pion-hbt-auau-19-6-gev/figures/figure-1
    belongs to Femtoscopy OG and is not public so only members of Femtoscopy group should see it.
    But if we install "nodeaccess" module and give a view access for an anonymous user to book pages (in this case)  [go here to see how to do it], then anonymous user can see a link above.
    To fix it one has to edit this page again (just edit and press submit) and then it will solve the problem and the page won't be seen by anybody except for member of Femtoscopy group anymore.

    [Important for STAR]
      This is on of a few reasons against installing this module in STAR Drupal because it would create a big mess.  
    If one grants "view" access to anonymous user for all book pages in module settings  then even if an OG page was not public before (visible only for selected organic group(s)) it will be seen now by an anonymous user. To fix it one would have to update all existing pages (not realistic in my opinion).
    One can say: Ok, then let's not grant a "view" access for anonymous user to book pages so we won't have this problem but unfortunately it won't work either because then all pages (even the one that already exists) won't be seen by an anonymous user. To fix it is not easier than in previous case and actually there is no straightforward way to do it. We cannot simply grant "view" privileges for anonymous user to each node because we didn't include this role in  allowed roles. The only trick that can do the job in this case is to update "node' (not nodeaccess) ACLs that should override existing privs set up by "nodeaccess"
  3. Module support: [Important for STAR]
    There is still no stable version of this module for D5.X (however there was a stable version for D4.7).
    Dev version was recently update in July and no news since then. There are many support requests on drupal.org that hasn't been addressed by author(s).

  4. Nodeaccess module (as well as CA+ACL) works good when setting up a node access for a specific user (however nodeaccess has a problem with an update described here.) However, this module doesn't provide us "protected" area type of access we need.
  5. My general concern is that this module changes existing functionality and privileges given by other modules and we don't have too much control on it.

After testing this module extensively I don't think it fits our needs (although I was very impressed by its functionality at the beginning :(

Appendix. More details by authors of "nodeaccess" module: Readme.txt

Node Access Module

This module allows you to manage permissions for nodes by role and user. In other words,
it implements per node access control for users and groups. With this module, you can
restrict access to any individual node without having to use taxonomy. You can assign
permission to view, edit or delete each individual node by user or role. Once enabled,
a 'grant' tab will appear on node pages. You can click this and assign permissions for
that node.

WARNINGS!

This is a development version for drupal 5.x. It has not been tested
extensively, and the upgrade process is rather complicated. Please do not throw
it on a production system. If you really need this module ASAP, please test it
out on a development copy of your website first.

INSTALLATION:

Put the module in your drupal modules directory and enable it in admin/modules.

If you are upgrading, be sure to run update.php as several changes are
required. This attempts to migrate your previous settings to the new setup in
drupal 5. I would strongly recommend backing up your database before installing
this module...

IMPORTANT!

Once you check the enable box and submit the page, no nodes will be accessible to anyone
other than the admin user. You just set permissions on the nodeaccess settings page
(admin/settings/nodeaccess) to enable access to your site.

The settings page has a section for roles, and then a section for every node type you
have on your site.

ALLOWED ROLES:

The allowed roles section allows you to choose what roles will appear on the node grant
tab. Just check each role you want to appear. Note that you can still set defaults for
all roles as the admin user, these options just hide what is available on each node
page.

NODE TYPE SETTINGS:

For each node type on your site, you can set default role access permissions and choose
if the grant tab should be available on that page. If the show grant tab option is
not checked, the grant tab will not appear on the node page regardless of user permissions.

For each node type, you can also choose the default permissions for that type. To emulate
standard drupal permissions, you would give anonymous user and authenticated user view permissions
for each node type. Note that once this module is first enabled, no permissions are granted, so
it is important to set defaults.

The default permissions for each node type will apply to any node which does not have
permissions set, either at the time you submit the settings or when any new node is
created. For already existing nodes, the defaults will apply only to those nodes which
have not had custom permissions set on the node grants tab.

TIPS:

If you grant authenticated users edit permission, you cannot revoke that for any user
who is a member of authenticated users. For example, if you wanted all users to be able
to edit a node except for one user, you cannot do this by granted edit permission to
authenticated users, then adding the user to the node without view permissions. Drupal
doesn't let you do that.

I haven't fully explored using this with multiple access control modules in
drupal 5 yet, so YMMV.

Protected area with OG mandatory group module

How to create "STAR Protected" area using OG+"OG-mandatory-group"?

  1. Install module "OG-mandatory-group"
  2. Create a new organic group e.g. "STAR Protected"
    •  disable it from registration form
    • set as "closed" - subscriptions are fully administered by an administrator. - then user cannot unsubscribe from this group
  3. Go to drupal.star.bnl.gov/STAR/admin/og/og_mandatory_group and set up "STAR Protected" to be a mandatory group.
    [I checked that new user is automatically subscribed to this group.]

    So far everything is working as expected and I found no problems. There is just one more issue to solve .

  4.  How to subscribe all existing users to "STAR Protected" group?
    I don't know if it's can be easily done in Drupal and the only solution I have in mind is to create a list of all users directly from drupal DB and then go to  "Add subscribers"  and paste this list.

Any questions?