Index: modules/playlist/playlist.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/playlist/playlist.module,v
retrieving revision 1.11
diff -u -r1.11 playlist.module
--- modules/playlist/playlist.module	14 Oct 2005 06:14:04 -0000	1.11
+++ modules/playlist/playlist.module	14 Oct 2005 11:30:30 -0000
@@ -24,7 +24,7 @@
  * Implementation of hook_perm().
  */
 function playlist_perm() {
-  return array('create playlist', 'edit playlist');
+  return array('create playlists', 'edit own playlists', 'view playlists', 'administer playlists');
 }
 
 /**
@@ -40,12 +40,16 @@
 function playlist_access($op, $node = null) {
   global $user;
 
+  if ($op == 'view'){
+	 return user_access('view playlists');
+  }
+
   if ($op == 'create') {
-    return user_access('create playlist');
+    return user_access('create playlists');
   }
 
   if ($op == 'update' || $op == 'delete') {
-    if (user_access('edit playlist')) {
+    if ((user_access('edit own playlists') && ($user->uid == $node->uid)) || user_access('administer playlists')) {
       return TRUE;
     }
   }
@@ -115,7 +119,7 @@
 							 'title' => t('manage playlist files'),
 							 'type' => MENU_LOCAL_TASK, 
 							 'weight' => 2,
-							 'access' => playlist_access('create', NULL));
+							 'access' => playlist_access('update', node_load(array('nid' => arg(1)), NULL, NULL)));
 			
 			$items[] = array('path' => 'node/'. arg(1) .'/playlist', 
 				'title' => t('stream playlist'),
@@ -353,10 +357,12 @@
 
 	$output .= form_group("Available audio files", _playlist_table(), "Use this table to select the audio files that you would like to add to this album. You can also add audio files to this album by clicking on the edit tab for the actual audio file as well.");
  	print theme('page', $output);
+
 }
 
 
 
+
 /**
  * TODO: Dependency on the audio module?...
  */
@@ -603,7 +609,7 @@
     							 l(t('pls'), 'node/'.$node->nid.'/playlist/pls', NULL)." ".
     							 l(t('xspf'), 'node/'.$node->nid.'/playlist/xspf', NULL));
   } 
-  if ($type == 'node' && $node->type == 'audio' && user_access('edit playlist')) {
+  if ($type == 'node' && $node->type == 'audio' && user_access('edit own playlists')) {
 	  $links[] .= l(t('add to playlist'), "playlist/additem/$node->nid", array('title' => t('Add this item to your personal playlist.')));  
   }						
   return $links;
@@ -696,7 +702,7 @@
       break;
       
     case 'form post':
-      if (variable_get('playlist_item_' . $node->type, 0) == 1 && user_access('edit playlist')) {
+      if (variable_get('playlist_item_' . $node->type, 0) == 1 && user_access('edit own playlists')) {
         return playlist_select_form($node); //so we can show a list of available albums in the dropdown list...
       }
       break;
