ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilWorkspaceAccessGUI Class Reference

ACL access handler GUI. More...

+ Collaboration diagram for ilWorkspaceAccessGUI:

Public Member Functions

 __construct (int $a_node_id, $a_access_handler, bool $a_is_portfolio=false, string $a_footer="")
 
 setBlockingMessage (string $a_val)
 
 getBlockingMessage ()
 
 executeCommand ()
 
 addPermissionHandler ()
 
 removePermission ()
 

Data Fields

const PERMISSION_REGISTERED = -1
 
const PERMISSION_ALL_PASSWORD = -3
 
const PERMISSION_ALL = -5
 

Protected Member Functions

 setObjectTitle ()
 
 getAccessHandler ()
 
 share ()
 
 initPasswordForm ()
 
 showPasswordForm (?ilPropertyFormGUI $a_form=null)
 
 savePasswordForm ()
 

Protected Attributes

ILIAS PersonalWorkspace InternalGUIService $gui
 
bool $is_portfolio
 
ilTabsGUI $tabs
 
ilGlobalTemplateInterface $tpl
 
ilToolbarGUI $toolbar
 
ilObjUser $user
 
ilSetting $settings
 
ilCtrl $ctrl
 
ilLanguage $lng
 
int $node_id
 
 $access_handler
 
string $footer = ""
 
string $blocking_message = ""
 
StandardGUIRequest $std_request
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilWorkspaceAccessGUI::__construct ( int  $a_node_id,
  $a_access_handler,
bool  $a_is_portfolio = false,
string  $a_footer = "" 
)
Parameters
ilPortfolioAccessHandler | ilWorkspaceAccessHandler$a_access_handler

Definition at line 55 of file class.ilWorkspaceAccessGUI.php.

References $DIC, $lng, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\settings(), ILIAS\Repository\tabs(), ILIAS\Repository\toolbar(), and ILIAS\Repository\user().

60  {
61  global $DIC;
62 
63  $this->tabs = $DIC->tabs();
64  $this->tpl = $DIC->ui()->mainTemplate();
65  $this->toolbar = $DIC->toolbar();
66  $this->user = $DIC->user();
67  $this->settings = $DIC->settings();
68  $ilCtrl = $DIC->ctrl();
69  $lng = $DIC->language();
70 
71  $this->ctrl = $ilCtrl;
72  $this->lng = $lng;
73  $this->node_id = $a_node_id;
74  $this->access_handler = $a_access_handler;
75  $this->is_portfolio = $a_is_portfolio;
76  $this->footer = $a_footer;
77  $this->std_request = new StandardGUIRequest(
78  $DIC->http(),
79  $DIC->refinery()
80  );
81  $this->gui = $DIC->personalWorkspace()->internal()->gui();
82  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ addPermissionHandler()

ilWorkspaceAccessGUI::addPermissionHandler ( )

Definition at line 252 of file class.ilWorkspaceAccessGUI.php.

References ILIAS\Repository\ctrl(), getAccessHandler(), ilUserAccountSettings\getInstance(), ILIAS\Repository\lng(), and showPasswordForm().

252  : void
253  {
254  switch ($this->std_request->getAction()) {
255  case "user":
256 
257  if (ilUserAccountSettings::getInstance()->isUserAccessRestricted()) {
258  $this->ctrl->redirectByClass("ilsingleusersharegui");
259  } else {
260  $this->ctrl->setParameterByClass("ilmailsearchgui", "ref", "wsp");
261  $this->ctrl->redirectByClass("ilmailsearchgui");
262  }
263  break;
264 
265  case "group":
266  $this->ctrl->setParameterByClass("ilmailsearchgroupsgui", "ref", "wsp");
267  $this->ctrl->redirectByClass("ilmailsearchgroupsgui");
268  break;
269 
270  case "course":
271  $this->ctrl->setParameterByClass("ilmailsearchcoursesgui", "ref", "wsp");
272  $this->ctrl->redirectByClass("ilmailsearchcoursesgui");
273  break;
274 
275  case "registered":
276  $this->getAccessHandler()->addMissingPermissionForObjects($this->node_id, [self::PERMISSION_REGISTERED]);
277  $this->tpl->setOnScreenMessage('success', $this->lng->txt("wsp_share_success"), true);
278  $this->ctrl->redirect($this, "share");
279  break;
280 
281  case "password":
282  $this->showPasswordForm();
283  break;
284 
285  case "all":
286  $this->getAccessHandler()->addMissingPermissionForObjects($this->node_id, [self::PERMISSION_ALL]);
287  $this->tpl->setOnScreenMessage('success', $this->lng->txt("wsp_permission_all_info"), true);
288  $this->ctrl->redirect($this, "share");
289  }
290  }
showPasswordForm(?ilPropertyFormGUI $a_form=null)
+ Here is the call graph for this function:

◆ executeCommand()

ilWorkspaceAccessGUI::executeCommand ( )

Definition at line 95 of file class.ilWorkspaceAccessGUI.php.

References $tabs, $tpl, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilPublicUserProfileGUI\setBackUrl(), ILIAS\UICore\GlobalTemplate\setContent(), and setObjectTitle().

95  : void
96  {
97  $ilTabs = $this->tabs;
98  $tpl = $this->tpl;
99  $next_class = $this->ctrl->getNextClass($this);
100  $cmd = $this->ctrl->getCmd();
101 
102  switch ($next_class) {
103  case "ilmailsearchcoursesgui":
104  $ilTabs->setBackTarget(
105  $this->lng->txt("back"),
106  $this->ctrl->getLinkTarget($this, "share")
107  );
108  $csearch = new ilMailSearchCoursesGUI($this->access_handler, $this->node_id);
109  $this->ctrl->setReturn($this, 'share');
110  $this->ctrl->forwardCommand($csearch);
111 
112  $this->setObjectTitle();
113  break;
114 
115  case "ilmailsearchgroupsgui":
116  $ilTabs->setBackTarget(
117  $this->lng->txt("back"),
118  $this->ctrl->getLinkTarget($this, "share")
119  );
120  $gsearch = new ilMailSearchGroupsGUI($this->access_handler, $this->node_id);
121  $this->ctrl->setReturn($this, 'share');
122  $this->ctrl->forwardCommand($gsearch);
123 
124  $this->setObjectTitle();
125  break;
126 
127  case "ilmailsearchgui":
128  $ilTabs->setBackTarget(
129  $this->lng->txt("back"),
130  $this->ctrl->getLinkTarget($this, "share")
131  );
132  $usearch = new ilMailSearchGUI($this->access_handler, $this->node_id);
133  $this->ctrl->setReturn($this, 'share');
134  $this->ctrl->forwardCommand($usearch);
135 
136  $this->setObjectTitle();
137  break;
138 
139  case "ilsingleusersharegui":
140  $ilTabs->setBackTarget(
141  $this->lng->txt("back"),
142  $this->ctrl->getLinkTarget($this, "share")
143  );
144  $ushare = new ilSingleUserShareGUI($this->access_handler, $this->node_id);
145  $this->ctrl->setReturn($this, 'share');
146  $this->ctrl->forwardCommand($ushare);
147 
148  $this->setObjectTitle();
149  break;
150 
151  case "ilpublicuserprofilegui":
152  $ilTabs->clearTargets();
153  $ilTabs->setBackTarget(
154  $this->lng->txt("back"),
155  $this->ctrl->getLinkTarget($this, "share")
156  );
157 
158  $prof = new ilPublicUserProfileGUI(
159  $this->std_request->getUser()
160  );
161  $prof->setBackUrl($this->ctrl->getLinkTarget($this, "share"));
162  $tpl->setContent($prof->getHTML());
163  break;
164 
165  default:
166  // $this->prepareOutput();
167  if (!$cmd) {
168  $cmd = "share";
169  }
170  //return $this->$cmd();
171  $this->$cmd();
172  break;
173  }
174  }
setContent(string $a_html)
Sets content for standard template.
setBackUrl(string $backurl)
Set Back Link URL.
GUI class for public user profile presentation.
ilGlobalTemplateInterface $tpl
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ getAccessHandler()

ilWorkspaceAccessGUI::getAccessHandler ( )
protected
Returns
ilPortfolioAccessHandler|ilWorkspaceAccessHandler

Definition at line 191 of file class.ilWorkspaceAccessGUI.php.

References $access_handler.

Referenced by addPermissionHandler(), removePermission(), savePasswordForm(), and share().

+ Here is the caller graph for this function:

◆ getBlockingMessage()

ilWorkspaceAccessGUI::getBlockingMessage ( )

Definition at line 90 of file class.ilWorkspaceAccessGUI.php.

References $blocking_message.

Referenced by share().

90  : string
91  {
93  }
+ Here is the caller graph for this function:

◆ initPasswordForm()

ilWorkspaceAccessGUI::initPasswordForm ( )
protected

Definition at line 303 of file class.ilWorkspaceAccessGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ilFormPropertyGUI\setRequired().

Referenced by savePasswordForm(), and showPasswordForm().

304  {
305  $form = new ilPropertyFormGUI();
306  $form->setFormAction($this->ctrl->getFormAction($this));
307  $form->setTitle($this->lng->txt("wsp_set_permission_all_password"));
308 
309  $password = new ilPasswordInputGUI($this->lng->txt("password"), "password");
310  $password->setRequired(true);
311  $form->addItem($password);
312 
313  $form->addCommandButton('savepasswordform', $this->lng->txt("save"));
314  $form->addCommandButton('share', $this->lng->txt("cancel"));
315 
316  return $form;
317  }
This class represents a password property in a property form.
setRequired(bool $a_required)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removePermission()

ilWorkspaceAccessGUI::removePermission ( )

Definition at line 292 of file class.ilWorkspaceAccessGUI.php.

References ILIAS\Repository\ctrl(), getAccessHandler(), and ILIAS\Repository\lng().

292  : void
293  {
294  $obj_id = $this->std_request->getObjId();
295  if ($obj_id !== 0) {
296  $this->getAccessHandler()->removePermission($this->node_id, $obj_id);
297  $this->tpl->setOnScreenMessage('success', $this->lng->txt("wsp_permission_removed"), true);
298  }
299 
300  $this->ctrl->redirect($this, "share");
301  }
+ Here is the call graph for this function:

◆ savePasswordForm()

ilWorkspaceAccessGUI::savePasswordForm ( )
protected

Definition at line 329 of file class.ilWorkspaceAccessGUI.php.

References ILIAS\Repository\ctrl(), getAccessHandler(), initPasswordForm(), ILIAS\Repository\lng(), and showPasswordForm().

329  : void
330  {
331  $form = $this->initPasswordForm();
332  if ($form->checkInput()) {
333  $this->getAccessHandler()->addPermission(
334  $this->node_id,
335  self::PERMISSION_ALL_PASSWORD,
336  md5($form->getInput("password"))
337  );
338  $this->tpl->setOnScreenMessage('success', $this->lng->txt("wsp_permission_all_pw_info"), true);
339  $this->ctrl->redirect($this, "share");
340  }
341 
342  $form->setValuesByPost();
343  $this->showPasswordForm($form);
344  }
showPasswordForm(?ilPropertyFormGUI $a_form=null)
+ Here is the call graph for this function:

◆ setBlockingMessage()

ilWorkspaceAccessGUI::setBlockingMessage ( string  $a_val)

Definition at line 85 of file class.ilWorkspaceAccessGUI.php.

Referenced by ilObjPortfolioGUI\executeCommand().

85  : void
86  {
87  $this->blocking_message = $a_val;
88  }
+ Here is the caller graph for this function:

◆ setObjectTitle()

ilWorkspaceAccessGUI::setObjectTitle ( )
protected

Definition at line 176 of file class.ilWorkspaceAccessGUI.php.

References $node_id, $tpl, ilObject\_lookupTitle(), and ILIAS\UICore\GlobalTemplate\setTitle().

Referenced by executeCommand().

176  : void
177  {
178  $tpl = $this->tpl;
179 
180  if (!$this->is_portfolio) {
181  $obj_id = $this->access_handler->getTree()->lookupObjectId($this->node_id);
182  } else {
183  $obj_id = $this->node_id;
184  }
186  }
setTitle(string $a_title, bool $hidden=false)
Sets title in standard template.
static _lookupTitle(int $obj_id)
ilGlobalTemplateInterface $tpl
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ share()

ilWorkspaceAccessGUI::share ( )
protected

Definition at line 196 of file class.ilWorkspaceAccessGUI.php.

References $footer, $ilSetting, $settings, $toolbar, $tpl, $user, ilParticipants\_getMembershipByType(), ILIAS\Repository\ctrl(), getAccessHandler(), getBlockingMessage(), ILIAS\Repository\lng(), and ILIAS\UICore\GlobalTemplate\setContent().

196  : void
197  {
198  $ilToolbar = $this->toolbar;
199  $tpl = $this->tpl;
200  $ilUser = $this->user;
202 
203 
204  // blocking message
205  if ($this->getBlockingMessage() != "") {
207  return;
208  }
209 
210  $options = array();
211  $options["user"] = $this->lng->txt("wsp_set_permission_single_user");
212 
213  $grp_ids = ilGroupParticipants::_getMembershipByType($ilUser->getId(), ['grp']);
214  if (sizeof($grp_ids)) {
215  $options["group"] = $this->lng->txt("wsp_set_permission_group");
216  }
217 
218  $crs_ids = ilCourseParticipants::_getMembershipByType($ilUser->getId(), ['crs']);
219  if (sizeof($crs_ids)) {
220  $options["course"] = $this->lng->txt("wsp_set_permission_course");
221  }
222 
223  if (!$this->getAccessHandler()->hasRegisteredPermission($this->node_id)) {
224  $options["registered"] = $this->lng->txt("wsp_set_permission_registered");
225  }
226 
227  if ($ilSetting->get("enable_global_profiles")) {
228  if (!$this->getAccessHandler()->hasGlobalPasswordPermission($this->node_id)) {
229  $options["password"] = $this->lng->txt("wsp_set_permission_all_password");
230  }
231 
232  if (!$this->getAccessHandler()->hasGlobalPermission($this->node_id)) {
233  $options["all"] = $this->lng->txt("wsp_set_permission_all");
234  }
235  }
236 
237  $actions = new ilSelectInputGUI("", "action");
238  $actions->setOptions($options);
239  $ilToolbar->addStickyItem($actions);
240 
241  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
242 
243  $this->gui->button(
244  $this->lng->txt("add"),
245  "addpermissionhandler"
246  )->submit()->toToolbar(true);
247 
248  $table = new ilWorkspaceAccessTableGUI($this, "share", $this->node_id, $this->getAccessHandler());
249  $tpl->setContent($table->getHTML() . $this->footer);
250  }
This class represents a selection list property in a property form.
setContent(string $a_html)
Sets content for standard template.
global $ilSetting
Definition: privfeed.php:31
ilGlobalTemplateInterface $tpl
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getMembershipByType(int $a_usr_id, array $a_type, bool $a_only_member_role=false)
get membership by type Get course or group membership
+ Here is the call graph for this function:

◆ showPasswordForm()

ilWorkspaceAccessGUI::showPasswordForm ( ?ilPropertyFormGUI  $a_form = null)
protected

Definition at line 319 of file class.ilWorkspaceAccessGUI.php.

References $tpl, initPasswordForm(), and ILIAS\UICore\GlobalTemplate\setContent().

Referenced by addPermissionHandler(), and savePasswordForm().

319  : void
320  {
321  $tpl = $this->tpl;
322 
323  if (!$a_form) {
324  $a_form = $this->initPasswordForm();
325  }
326  $tpl->setContent($a_form->getHTML());
327  }
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access_handler

ilWorkspaceAccessGUI::$access_handler
protected

Definition at line 46 of file class.ilWorkspaceAccessGUI.php.

Referenced by getAccessHandler().

◆ $blocking_message

string ilWorkspaceAccessGUI::$blocking_message = ""
protected

Definition at line 49 of file class.ilWorkspaceAccessGUI.php.

Referenced by getBlockingMessage().

◆ $ctrl

ilCtrl ilWorkspaceAccessGUI::$ctrl
protected

Definition at line 40 of file class.ilWorkspaceAccessGUI.php.

◆ $footer

string ilWorkspaceAccessGUI::$footer = ""
protected

Definition at line 47 of file class.ilWorkspaceAccessGUI.php.

Referenced by share().

◆ $gui

ILIAS PersonalWorkspace InternalGUIService ilWorkspaceAccessGUI::$gui
protected

Definition at line 33 of file class.ilWorkspaceAccessGUI.php.

◆ $is_portfolio

bool ilWorkspaceAccessGUI::$is_portfolio
protected

Definition at line 34 of file class.ilWorkspaceAccessGUI.php.

◆ $lng

ilLanguage ilWorkspaceAccessGUI::$lng
protected

Definition at line 41 of file class.ilWorkspaceAccessGUI.php.

Referenced by __construct().

◆ $node_id

int ilWorkspaceAccessGUI::$node_id
protected

Definition at line 42 of file class.ilWorkspaceAccessGUI.php.

Referenced by setObjectTitle().

◆ $settings

ilSetting ilWorkspaceAccessGUI::$settings
protected

Definition at line 39 of file class.ilWorkspaceAccessGUI.php.

Referenced by share().

◆ $std_request

StandardGUIRequest ilWorkspaceAccessGUI::$std_request
protected

Definition at line 50 of file class.ilWorkspaceAccessGUI.php.

◆ $tabs

ilTabsGUI ilWorkspaceAccessGUI::$tabs
protected

Definition at line 35 of file class.ilWorkspaceAccessGUI.php.

Referenced by executeCommand().

◆ $toolbar

ilToolbarGUI ilWorkspaceAccessGUI::$toolbar
protected

Definition at line 37 of file class.ilWorkspaceAccessGUI.php.

Referenced by share().

◆ $tpl

ilGlobalTemplateInterface ilWorkspaceAccessGUI::$tpl
protected

◆ $user

ilObjUser ilWorkspaceAccessGUI::$user
protected

Definition at line 38 of file class.ilWorkspaceAccessGUI.php.

Referenced by share().

◆ PERMISSION_ALL

◆ PERMISSION_ALL_PASSWORD

◆ PERMISSION_REGISTERED


The documentation for this class was generated from the following file: