ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjGroupAccess.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2008 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 include_once("./classes/class.ilObjectAccess.php");
25 
35 {
48  function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = "")
49  {
50 
51  global $ilUser, $lng, $rbacsystem, $ilAccess;
52 
53  if ($a_user_id == "")
54  {
55  $a_user_id = $ilUser->getId();
56  }
57 
58  switch ($a_cmd)
59  {
60  case "info":
61 
62  include_once './Modules/Group/classes/class.ilGroupParticipants.php';
63  if(ilGroupParticipants::_isParticipant($a_ref_id,$a_user_id))
64  {
65  $ilAccess->addInfoItem(IL_STATUS_MESSAGE, $lng->txt("info_is_member"));
66  }
67  else
68  {
69  $ilAccess->addInfoItem(IL_STATUS_MESSAGE, $lng->txt("info_is_not_member"));
70  }
71  break;
72 
73  case "join":
74 
75  include_once './Modules/Group/classes/class.ilGroupWaitingList.php';
76  if(ilGroupWaitingList::_isOnList($ilUser->getId(), $a_obj_id))
77  {
78  return false;
79  }
80 
81  include_once './Modules/Group/classes/class.ilGroupParticipants.php';
82  if(ilGroupParticipants::_isParticipant($a_ref_id,$a_user_id))
83  {
84  return false;
85  }
86  break;
87 
88  case 'leave':
89 
90  // Regular member
91  if($a_permission == 'leave')
92  {
93  include_once './Modules/Group/classes/class.ilGroupParticipants.php';
94  if(!ilGroupParticipants::_isParticipant($a_ref_id, $a_user_id))
95  {
96  return false;
97  }
98  }
99  // Waiting list
100  if($a_permission == 'join')
101  {
102  include_once './Modules/Group/classes/class.ilGroupWaitingList.php';
103  if(!ilGroupWaitingList::_isOnList($ilUser->getId(), $a_obj_id))
104  {
105  return false;
106  }
107  }
108  break;
109 
110  }
111 
112  switch ($a_permission)
113  {
114 
115  }
116  return true;
117  }
118 
131  function _getCommands()
132  {
133  $commands = array();
134  $commands[] = array("permission" => "read", "cmd" => "view", "lang_var" => "show", "default" => true);
135  $commands[] = array("permission" => "join", "cmd" => "join", "lang_var" => "join");
136 
137  // on waiting list
138  $commands[] = array('permission' => "join", "cmd" => "leave", "lang_var" => "leave_waiting_list");
139 
140  // regualar users
141  $commands[] = array('permission' => "leave", "cmd" => "leave", "lang_var" => "grp_btn_unsubscribe");
142  // BEGIN WebDAV: Mount Webfolder.
143  require_once ('Services/WebDAV/classes/class.ilDAVActivationChecker.php');
145  {
146  $commands[] = array("permission" => "read", "cmd" => "mount_webfolder", "lang_var" => "mount_webfolder", "enable_anonymous" => "false");
147  }
148  // END WebDAV: Mount Webfolder.
149  $commands[] = array("permission" => "write", "cmd" => "edit", "lang_var" => "edit");
150 
151  return $commands;
152  }
153 
157  function _checkGoto($a_target)
158  {
159  global $ilAccess;
160 
161  $t_arr = explode("_", $a_target);
162 
163  if ($t_arr[0] != "grp" || ((int) $t_arr[1]) <= 0)
164  {
165  return false;
166  }
167 
168  if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
169  $ilAccess->checkAccess("visible", "", $t_arr[1]))
170  {
171  return true;
172  }
173  return false;
174  }
175 
176 }
177 ?>