ILIAS  release_8 Revision v8.24
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

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 54 of file class.ilWorkspaceAccessGUI.php.

59 {
60 global $DIC;
61
62 $this->tabs = $DIC->tabs();
63 $this->tpl = $DIC->ui()->mainTemplate();
64 $this->toolbar = $DIC->toolbar();
65 $this->user = $DIC->user();
66 $this->settings = $DIC->settings();
67 $ilCtrl = $DIC->ctrl();
68 $lng = $DIC->language();
69
70 $this->ctrl = $ilCtrl;
71 $this->lng = $lng;
72 $this->node_id = $a_node_id;
73 $this->access_handler = $a_access_handler;
74 $this->is_portfolio = $a_is_portfolio;
75 $this->footer = $a_footer;
76 $this->std_request = new StandardGUIRequest(
77 $DIC->http(),
78 $DIC->refinery()
79 );
80 }
global $DIC
Definition: feed.php:28

References $DIC, $lng, ILIAS\Repository\ctrl(), ILIAS\UI\examples\MainControls\Footer\footer(), ILIAS\Repository\lng(), ILIAS\Repository\settings(), ILIAS\Repository\tabs(), ILIAS\Repository\toolbar(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ addPermissionHandler()

ilWorkspaceAccessGUI::addPermissionHandler ( )

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

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

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

+ Here is the call graph for this function:

◆ executeCommand()

ilWorkspaceAccessGUI::executeCommand ( )

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

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

References $tabs, $tpl, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilGlobalTemplateInterface\setContent(), and setObjectTitle().

+ Here is the call graph for this function:

◆ getAccessHandler()

ilWorkspaceAccessGUI::getAccessHandler ( )
protected
Returns
ilPortfolioAccessHandler|ilWorkspaceAccessHandler

Definition at line 189 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 88 of file class.ilWorkspaceAccessGUI.php.

88 : string
89 {
91 }

References $blocking_message.

Referenced by share().

+ Here is the caller graph for this function:

◆ initPasswordForm()

ilWorkspaceAccessGUI::initPasswordForm ( )
protected

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

302 {
303 $form = new ilPropertyFormGUI();
304 $form->setFormAction($this->ctrl->getFormAction($this));
305 $form->setTitle($this->lng->txt("wsp_set_permission_all_password"));
306
307 $password = new ilPasswordInputGUI($this->lng->txt("password"), "password");
308 $password->setRequired(true);
309 $form->addItem($password);
310
311 $form->addCommandButton('savepasswordform', $this->lng->txt("save"));
312 $form->addCommandButton('share', $this->lng->txt("cancel"));
313
314 return $form;
315 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a property form user interface.

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

Referenced by savePasswordForm(), and showPasswordForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removePermission()

ilWorkspaceAccessGUI::removePermission ( )

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

290 : void
291 {
292 $obj_id = $this->std_request->getObjId();
293 if ($obj_id !== 0) {
294 $this->getAccessHandler()->removePermission($this->node_id, $obj_id);
295 $this->tpl->setOnScreenMessage('success', $this->lng->txt("wsp_permission_removed"), true);
296 }
297
298 $this->ctrl->redirect($this, "share");
299 }

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

+ Here is the call graph for this function:

◆ savePasswordForm()

ilWorkspaceAccessGUI::savePasswordForm ( )
protected

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

327 : void
328 {
329 $form = $this->initPasswordForm();
330 if ($form->checkInput()) {
331 $this->getAccessHandler()->addPermission(
332 $this->node_id,
333 self::PERMISSION_ALL_PASSWORD,
334 md5($form->getInput("password"))
335 );
336 $this->tpl->setOnScreenMessage('success', $this->lng->txt("wsp_permission_all_pw_info"), true);
337 $this->ctrl->redirect($this, "share");
338 }
339
340 $form->setValuesByPost();
341 $this->showPasswordForm($form);
342 }

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

+ Here is the call graph for this function:

◆ setBlockingMessage()

ilWorkspaceAccessGUI::setBlockingMessage ( string  $a_val)

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

83 : void
84 {
85 $this->blocking_message = $a_val;
86 }

◆ setObjectTitle()

ilWorkspaceAccessGUI::setObjectTitle ( )
protected

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

174 : void
175 {
177
178 if (!$this->is_portfolio) {
179 $obj_id = $this->access_handler->getTree()->lookupObjectId($this->node_id);
180 } else {
181 $obj_id = $this->node_id;
182 }
184 }
static _lookupTitle(int $obj_id)
setTitle(string $a_title, bool $hidden=false)
Sets title in standard template.

References $node_id, $tpl, ilObject\_lookupTitle(), and ilGlobalTemplateInterface\setTitle().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ share()

ilWorkspaceAccessGUI::share ( )
protected

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

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

References $ilSetting, $ilUser, $settings, $toolbar, $tpl, $user, ilParticipants\_getMembershipByType(), ILIAS\Repository\ctrl(), getAccessHandler(), getBlockingMessage(), ilSubmitButton\getInstance(), ILIAS\Repository\lng(), and ilGlobalTemplateInterface\setContent().

+ Here is the call graph for this function:

◆ showPasswordForm()

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

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

317 : void
318 {
320
321 if (!$a_form) {
322 $a_form = $this->initPasswordForm();
323 }
324 $tpl->setContent($a_form->getHTML());
325 }

References $tpl, initPasswordForm(), and ilGlobalTemplateInterface\setContent().

Referenced by addPermissionHandler(), and savePasswordForm().

+ 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 45 of file class.ilWorkspaceAccessGUI.php.

Referenced by getAccessHandler().

◆ $blocking_message

string ilWorkspaceAccessGUI::$blocking_message = ""
protected

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

Referenced by getBlockingMessage().

◆ $ctrl

ilCtrl ilWorkspaceAccessGUI::$ctrl
protected

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

◆ $footer

string ilWorkspaceAccessGUI::$footer = ""
protected

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

◆ $is_portfolio

bool ilWorkspaceAccessGUI::$is_portfolio
protected

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

◆ $lng

ilLanguage ilWorkspaceAccessGUI::$lng
protected

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

Referenced by __construct().

◆ $node_id

int ilWorkspaceAccessGUI::$node_id
protected

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

Referenced by setObjectTitle().

◆ $settings

ilSetting ilWorkspaceAccessGUI::$settings
protected

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

Referenced by share().

◆ $std_request

StandardGUIRequest ilWorkspaceAccessGUI::$std_request
protected

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

◆ $tabs

ilTabsGUI ilWorkspaceAccessGUI::$tabs
protected

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

Referenced by executeCommand().

◆ $toolbar

ilToolbarGUI ilWorkspaceAccessGUI::$toolbar
protected

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

Referenced by share().

◆ $tpl

ilGlobalTemplateInterface ilWorkspaceAccessGUI::$tpl
protected

◆ $user

ilObjUser ilWorkspaceAccessGUI::$user
protected

Definition at line 37 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: