Add support for hidden lists via access roles

GregoryHeller - March 24, 2006 - 22:44
Project:Mailing List Manager
Version:HEAD
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Mailing lists should be "public" or "private", or role based, so that users can only see mailing lists based upon their user role.

#1

arthurf - July 3, 2006 - 16:42

I did this on this node:

http://drupal.org/node/69002

#2

Allie Micka - July 5, 2006 - 15:22

Please submit patches by issue, not in rollup patches.

I would prefer not to add complexity or hijack the status flag, which means something very different already. This also does not provide any role/permissions functionality, or allow the list to be usable/meaningful in any other way if Drupal thinks it's unpublished.

Perhaps the most appropriate solution for this is "subscribe to " on the admin/access page?

Without the use of node_access modules, we won't be able to hide it completely. I suspect this is why you're trying to hijack status. But we can hide it from the /mlm page by respecting the access settings.

One use case we will definitely want to address is providing a mechanism for people who are subscribed, don't want to be, and still need the ability to unsubscribe themselves.

#3

arthurf - July 19, 2006 - 23:12

Ok so I see the logic for display being:

if the user is a subscriber, display, else if the list is not hidden, display

Now the question is where do we want to store this value if we're not using the node status- it seems like we could use the mlm settings table, or we could store something in the variables table. Variables table seems like a less sustainable way to do this and since we already have the mlm settings table, might be a logical place to put it.

#4

arthurf - July 19, 2006 - 23:21

so maybe name = visibility, value = 0 or 1 ?

#5

arthurf - August 2, 2006 - 18:01
Title:Add support for hidden lists» Add support for hidden lists via access roles

Here's the code I'm using to do it via access roles:

function mlm_perm() {
  $prems =array(
    'administer mlm',
    'administer mailing lists',
    'administer own mailing list');
       
  foreach (mlm_lists() as $list) {
$prems[] = "subscribe to: " . $list->title;
}
  return $prems;
}

and

unction mlm_lists($list_type=null, $backend=null, $mail=null) {
  $lists = array();
  if (is_object($mail)) $mail = $mail->mail;
 
  $res = db_query(db_rewrite_sql("SELECT n.nid FROM {node} n
      LEFT JOIN {mlm} USING ( nid )
      WHERE n.type = 'mlm'
      ORDER BY n.title"));
     
  while ($row = db_fetch_object($res)) {
    $list = node_load($row->nid);
    if ($mail) {
      $list->subscribed = mlm_is_subscribed($list, $mail);
    }
    // only return accessible lists
    if (user_access("subscribe to: " . $list->title)) {   
      $lists[$list->nid] = $list;
    }
  }
  return $lists;
}

#6

Allie Micka - July 8, 2008 - 16:12

Upcoming work on this will involve node access settings, since node access modules are no longer mutually exclusive, and you get list hiding 'for free'.

The biggest hangup is UI.

 
 

Drupal is a registered trademark of Dries Buytaert.