Public Member Functions | Data Fields

ilObjectStatusGUI Class Reference
[Services/AccessControl]

This class displays the permission status of a user concerning a specific object. More...

Public Member Functions

 ilObjectStatusGUI (&$a_obj)
 Constructor public.
executeCommand ()
 execute command
__initTableGUI ()
 __setTableGUIBasicData (&$tbl, &$result_set, $from="")
 __showPermissionsTable ($a_result_set)
 __showRolesTable ($a_result_set)
 __showObjectSummaryTable ($a_result_set)
 getHTML ()
 getAssignedValidRoles ()
 getPermissionInfo ()
 getRoleAssignmentInfo ()
 getObjectSummary ()
 getCommands ($a_type)

Data Fields

 $lng
 $ilias
 $tpl
 $tree
 $rbacsystem
 $cur_ref_id
 $cmd
 $mode
 $ctrl

Detailed Description

This class displays the permission status of a user concerning a specific object.

("Permissions" -> "Permission of User")

Author:
Sascha Hofmann <saschahofmann@gmx.de>
Version:
Id:
class.ilObjectStatusGUI.php 12941 2007-01-08 11:30:25Z shofmann

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


Member Function Documentation

& ilObjectStatusGUI::__initTableGUI (  ) 

Definition at line 110 of file class.ilObjectStatusGUI.php.

Referenced by __showObjectSummaryTable(), __showPermissionsTable(), and __showRolesTable().

        {
                include_once "class.ilTableGUI.php";

                return new ilTableGUI(0,false);
        }

Here is the caller graph for this function:

ilObjectStatusGUI::__setTableGUIBasicData ( &$  tbl,
&$  result_set,
from = "" 
)

Definition at line 117 of file class.ilObjectStatusGUI.php.

References $lng, and $tbl.

Referenced by __showObjectSummaryTable(), __showPermissionsTable(), and __showRolesTable().

        {
        global $lng;

                $tbl->disable('footer');
                $tbl->disable('linkbar');
                $tbl->disable('hits');
                $tbl->disable('sort');

                $tbl->setLimit(0);
                $tbl->setData($result_set);
        }

Here is the caller graph for this function:

ilObjectStatusGUI::__showObjectSummaryTable ( a_result_set  ) 

Definition at line 175 of file class.ilObjectStatusGUI.php.

References $lng, $tbl, $tpl, __initTableGUI(), __setTableGUIBasicData(), and ilUtil::getImagePath().

Referenced by getObjectSummary().

        {
        global $lng;

        $tbl =& $this->__initTableGUI();
                $tpl =& $tbl->getTemplateObject();
                
                $tpl->setCurrentBlock("tbl_form_header");
                $tpl->setVariable("FORMACTION",$this->ctrl->getFormActionByClass("ilpermissiongui","info"));
                $tpl->parseCurrentBlock();

                $tpl->setCurrentBlock("tbl_action_row");
                
        $tpl->setCurrentBlock("plain_button");
                $tpl->setVariable("PBTN_NAME","info");
                $tpl->setVariable("PBTN_VALUE",$lng->txt("info_change_user_view"));
                $tpl->parseCurrentBlock();
                $tpl->setCurrentBlock("plain_buttons");
                $tpl->parseCurrentBlock();
                
                $tpl->setVariable("COLUMN_COUNTS",7);
                $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("spacer.gif"));

                $tpl->setVariable("TPLPATH",$this->tpl->tplPath);

                // title & header columns
                $tbl->setTitle($lng->txt("info_access_and_status_info"));

                //user must be member
                $tbl->setHeaderNames(array("&nbsp;",$lng->txt("info_enter_login_or_id")));
                //$tbl->setHeaderVars(array("operation","granted"),$this->ctrl->getParameterArray($this->object,"",false));
                $tbl->setHeaderVars(array("",""),"");
                $tbl->setColumnWidth(array("15%","85%"));


                $this->__setTableGUIBasicData($tbl,$a_result_set);
                //$tbl->setStyle('table','std');
                $tbl->render();
                $this->tpl->setVariable('INFO_SUMMARY',$tbl->tpl->get());
                
                return $tbl->tpl->get();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjectStatusGUI::__showPermissionsTable ( a_result_set  ) 

Definition at line 130 of file class.ilObjectStatusGUI.php.

References $lng, $tbl, $tpl, __initTableGUI(), and __setTableGUIBasicData().

Referenced by getPermissionInfo().

        {
        global $lng;

        $tbl =& $this->__initTableGUI();
                $tpl =& $tbl->getTemplateObject();

                // title & header columns
                $tbl->setTitle($lng->txt("info_access_permissions"),"icon_perm.gif",$lng->txt("info_access_permissions"));

                //user must be member
                $tbl->setHeaderNames(array("",$lng->txt("operation"),$lng->txt("info_from_role")));
                //$tbl->setHeaderVars(array("operation","granted"),$this->ctrl->getParameterArray($this->object,"",false));
                $tbl->setHeaderVars(array("","operation","role"),"");
                $tbl->setColumnWidth(array("1%","39%","60%"));


                $this->__setTableGUIBasicData($tbl,$a_result_set);
                $tbl->setStyle('table','std');
                $tbl->render();
                $this->tpl->setVariable('INFO_PERMISSIONS',$tbl->tpl->get());
                
                return $tbl->tpl->get();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjectStatusGUI::__showRolesTable ( a_result_set  ) 

Definition at line 155 of file class.ilObjectStatusGUI.php.

References $lng, $tbl, $tpl, __initTableGUI(), and __setTableGUIBasicData().

Referenced by getRoleAssignmentInfo().

        {
        global $lng;

        $tbl =& $this->__initTableGUI();
                $tpl =& $tbl->getTemplateObject();

                // title & header columns
                $tbl->setTitle($lng->txt("info_available_roles"),"icon_rolf.gif",$lng->txt("info_available_roles"));

                $tbl->setHeaderNames(array("",$lng->txt("role"),str_replace(" ","&nbsp;",$lng->txt("info_permission_source")),str_replace(" ","&nbsp;",$lng->txt("info_permission_origin"))));
                $tbl->setColumnWidth(array("1%","19%","40%","40%"));
                $this->__setTableGUIBasicData($tbl,$a_result_set);
                $tbl->setStyle('table','std');
                $tbl->render();
                $this->tpl->setVariable('INFO_ROLES',$tbl->tpl->get());
                
                return $tbl->tpl->get();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

& ilObjectStatusGUI::executeCommand (  ) 

execute command

Definition at line 104 of file class.ilObjectStatusGUI.php.

        {
                $next_class = $this->ctrl->getNextClass($this);
                $this->ctrl->setCmd("");
        }

ilObjectStatusGUI::getAssignedValidRoles (  ) 

Definition at line 223 of file class.ilObjectStatusGUI.php.

References $ops, $ops_data, $rbacreview, ilObjRole::_getTranslation(), and getOperationList().

Referenced by ilObjectStatusGUI().

        {
                global $rbacreview;
                
                include_once ('class.ilObjRole.php');

                $assigned_valid_roles = array();

                foreach ($this->valid_roles as $role)
                {
                        if (in_array($role['obj_id'],$this->user_roles))
                        {
                                if ($role["obj_id"] == SYSTEM_ROLE_ID)
                                {
                                        // get all possible operation of current object
                                        $ops_list = getOperationList($this->object->getType());
                                        
                                        foreach ($ops_list as $ops_data)
                                        {
                                                $ops[] = (int) $ops_data['ops_id'];
                                        }
                                        
                                        $role['ops'] = $ops;
                                }
                                else
                                {
                                        $role['ops'] = $rbacreview->getRoleOperationsOnObject($role["obj_id"],$this->object->getRefId());
                                }
                                
                                $role['translation'] = str_replace(" ","&nbsp;",ilObjRole::_getTranslation($role["title"]));
                                $assigned_valid_roles[] = $role;
                        }
                }
                
                return $assigned_valid_roles;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjectStatusGUI::getCommands ( a_type  ) 

Definition at line 464 of file class.ilObjectStatusGUI.php.

Referenced by getObjectSummary().

        {
                global $objDefinition;
                                
                $class = $objDefinition->getClassName($a_type);
                $location = $objDefinition->getLocation($a_type);
                $full_class = "ilObj".$class."Access";
                include_once($location."/class.".$full_class.".php");
                
                $cmds = call_user_func(array($full_class, "_getCommands"));
                
                array_push($cmds,array('permission' => 'visible','cmd' => 'info'));
                
                return $cmds;
        }

Here is the caller graph for this function:

ilObjectStatusGUI::getHTML (  ) 

Definition at line 218 of file class.ilObjectStatusGUI.php.

        {
                return $this->tpl->get();
        }

ilObjectStatusGUI::getObjectSummary (  ) 

Definition at line 377 of file class.ilObjectStatusGUI.php.

References $cmd, $ilias, $lng, $rbacreview, __showObjectSummaryTable(), and getCommands().

Referenced by ilObjectStatusGUI().

        {
                global $lng,$rbacreview,$ilAccess,$ilias;
                $infos = array();
                
                $input_field = "<input class=\"std\" type=\"input\" name=\"Fuserid\" value=\"".$this->user->getLogin()."\"/>";
                $input_radio_login = "<input class=\"std\" id=\"select_type_login\" type=\"radio\" name=\"Fselect_type\" value=\"login\" checked=\"checked\" />";
                $input_radio_id = "<input class=\"std\" id=\"select_type_id\" type=\"radio\" name=\"Fselect_type\" value=\"id\" />";

                $result_set[0][] = "&nbsp;";
                $result_set[0][] = $input_field."&nbsp;".$input_radio_login."<label for=\"select_type_login\">".$lng->txt('login')."</label>".$input_radio_id."<label for=\"select_type_id\">".$lng->txt('id')."</label>";
                
                $result_set[1][] = "<b>".$lng->txt("info_view_of_user")."</b>";
                $result_set[1][] = $this->user->getFullname()." (#".$this->user->getId().")";
                
                $assigned_valid_roles = array();

                foreach ($this->assigned_valid_roles as $role)
                {
                        $assigned_valid_roles[] = $role["translation"];
                }
                
                $roles_str = implode(", ",$assigned_valid_roles);
                        
                $result_set[2][] = "<b>".$lng->txt("roles")."</b>";
                $result_set[2][] = $roles_str;
                
                $result_set[4][] = "<b>".$lng->txt("status")."</b>";

                $ilAccess->clear();
                $ilAccess->doTreeCheck("visible","info",$this->object->getRefId(),$this->user->getId());
                $infos = array_merge($infos,$ilAccess->getInfo());

                $ilAccess->clear();
                $ilAccess->doPathCheck("visible","info",$this->object->getRefId(),$this->user->getId(),true);
                $infos = array_merge($infos,$ilAccess->getInfo());

                $ilAccess->clear();
                $ilAccess->doConditionCheck("read","info",$this->object->getRefId(),$this->user->getId(),$this->object->getId(),$this->object->getType());
                $infos = array_merge($infos,$ilAccess->getInfo());
                
                $cmds = $this->getCommands($this->object->getType());

                $ilAccess->clear();             
                foreach ($cmds as $cmd)
                {

                        $ilAccess->doStatusCheck($cmd['permission'],$cmd['cmd'],$this->object->getRefId(),$this->user->getId(),$this->object->getId(),$this->object->getType());
                        $infos = array_merge($infos,$ilAccess->getInfo());
                }

                $alert = "il_ItemAlertProperty";
                $okay = "il_ItemOkayProperty";

                if (!$infos)
                {
                        $text = "<span class=\"".$okay."\">".$lng->txt("access")."</span><br/> ";
                }
                else
                {
                        foreach ($infos as $info)
                        {
                                switch ($info['type'])
                                {
                                        case IL_STATUS_MESSAGE:
                                                $text .= "<span class=\"".$okay."\">".$info['text']."</span><br/> ";
                                                break;
                                                
                                        case IL_NO_PARENT_ACCESS:
                                                $obj = $ilias->obj_factory->getInstanceByRefId($info['data']);
                                                $text .= "<span class=\"".$alert."\">".$info['text']." (".$lng->txt("obj_".$obj->getType())." #".$obj->getId().": ".$obj->getTitle().")</span><br/> ";
                                                break;
                                                
                                                
                                        default:
                                                $text .= "<span class=\"".$alert."\">".$info['text']."</span><br/> ";
                                                break;
                                        
                                }
                        }
                }

                $result_set[4][] = $text;

                return $this->__showObjectSummaryTable($result_set);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjectStatusGUI::getPermissionInfo (  ) 

Definition at line 260 of file class.ilObjectStatusGUI.php.

References $counter, $lng, $ops, $rbacreview, __showPermissionsTable(), and getOperationList().

Referenced by ilObjectStatusGUI().

        {
                global $ilAccess,$lng,$rbacreview,$ilUser,$ilObjDataCache;

                // icon handlers
                $icon_ok = "<img src=\"".ilUtil::getImagePath("icon_ok.gif")."\" alt=\"".$lng->txt("info_assigned")."\" title=\"".$lng->txt("info_assigned")."\" border=\"0\" vspace=\"0\"/>";
                $icon_not_ok = "<img src=\"".ilUtil::getImagePath("icon_not_ok.gif")."\" alt=\"".$lng->txt("info_not_assigned")."\" title=\"".$lng->txt("info_not_assigned")."\" border=\"0\" vspace=\"0\"/>";
                
                // get all possible operation of current object
                $ops_list = getOperationList($this->object->getType());
                
                $counter = 0;

                // check permissions of user
                foreach ($ops_list as $ops)
                {
                        $access = $ilAccess->doRBACCheck($ops['operation'],"info",$this->object->getRefId(),$this->user->getId());

                        $result_set[$counter][] = $access ? $icon_ok : $icon_not_ok;
                        $result_set[$counter][] = $lng->txt($this->object->getType()."_".$ops['operation']);
                        
                        $list_role = "";

                        // Check ownership
                        if($this->user->getId() == $ilObjDataCache->lookupOwner($this->object->getId()))
                        {
                                $list_role[] = $lng->txt('info_owner_of_object');
                        }
                        // get operations on object for each assigned role to user
                        foreach ($this->assigned_valid_roles as $role)
                        {
                                if (in_array($ops['ops_id'],$role['ops']))
                                {
                                        $list_role[] = $role['translation'];
                                }
                        }
                        
                        if (empty($list_role))
                        {
                                $roles_formatted = $lng->txt('none');
                        }
                        else
                        {
                                $roles_formatted = implode("<br/>",$list_role);
                        }

                        $result_set[$counter][] = $roles_formatted;
        
                        ++$counter;
                }

                return $this->__showPermissionsTable($result_set);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjectStatusGUI::getRoleAssignmentInfo (  ) 

Definition at line 314 of file class.ilObjectStatusGUI.php.

References $counter, $lng, $rbacreview, $tree, __showRolesTable(), and ilObjRole::_getTranslation().

Referenced by ilObjectStatusGUI().

        {
                global $lng,$rbacreview,$tree;

                // icon handlers
                $icon_ok = "<img src=\"".ilUtil::getImagePath("icon_ok.gif")."\" alt=\"".$lng->txt("info_assigned")."\" title=\"".$lng->txt("info_assigned")."\" border=\"0\" vspace=\"0\"/>";
                $icon_not_ok = "<img src=\"".ilUtil::getImagePath("icon_not_ok.gif")."\" alt=\"".$lng->txt("info_not_assigned")."\" title=\"".$lng->txt("info_not_assigned")."\" border=\"0\" vspace=\"0\"/>";

                $path = array_reverse($tree->getPathId($this->object->getRefId()));
                
                include_once ('class.ilObjRole.php');

                $counter = 0;

                foreach ($this->valid_roles as $role)
                {
                        $result_set[$counter][] = in_array($role['obj_id'],$this->user_roles) ? $icon_ok : $icon_not_ok;
                        $result_set[$counter][] = str_replace(" ","&nbsp;",ilObjRole::_getTranslation($role["title"]));
                        
                        if ($role['role_type'] != "linked")
                        {
                                $result_set[$counter][] = "";
                        }
                        else
                        {
                                $rolfs = $rbacreview->getFoldersAssignedToRole($role["obj_id"]);

                                // ok, try to match the next rolf in path
                                foreach ($path as $node)
                                {
                                        if ($node == 1)
                                        {
                                                break;
                                        }
                                
                                        $rolf = $rbacreview->getRoleFolderOfObject($node);

                                        if (in_array($rolf['ref_id'],$rolfs))
                                        {
                                                $nodedata = $tree->getNodeData($node);
                                                $result_set[$counter][] = $nodedata["title"];
                                                break;
                                        }                                                       
                                }
                        }
                        
                        if (in_array($role['obj_id'],$this->global_roles))
                        {
                                $result_set[$counter][] = $lng->txt("global");
                        }
                        else
                        {
                                $rolf = $rbacreview->getFoldersAssignedToRole($role["obj_id"],true);
                                $parent_node = $tree->getParentNodeData($rolf[0]);
                                $result_set[$counter][] = $parent_node["title"];
                        }
                                        
                        ++$counter;     
                }
                
                return $this->__showRolesTable($result_set);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjectStatusGUI::ilObjectStatusGUI ( &$  a_obj  ) 

Constructor public.

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

References $_POST, $ilCtrl, $ilErr, $ilias, $lng, $rbacreview, $user_id, ilObjUser::_lookupId(), getAssignedValidRoles(), getObjectSummary(), getPermissionInfo(), getRoleAssignmentInfo(), and sendInfo().

        {
                global $ilUser,$ilCtrl,$ilias,$ilErr,$lng,$rbacreview;

                $this->ctrl =& $ilCtrl;
                $this->object =& $a_obj;
                
                $this->tpl = new ilTemplate("tpl.info_layout.html", false, false);
                $this->tpl->setVariable("INFO_REMARK_INTERRUPTED",$lng->txt('info_remark_interrupted'));

                if (empty($_POST['Fuserid']))
                {
                        $this->user =& $ilUser;
                }
                else
                {
                        if ($_POST['Fselect_type'] == "id")
                        {
                                $this->user = $ilias->obj_factory->getInstanceByObjId($_POST['Fuserid'],false);
                        }
                        else
                        {
                                include_once('class.ilObjUser.php');
                                $user_id = ilObjUser::_lookupId($_POST['Fuserid']);
                                $this->user = $ilias->obj_factory->getInstanceByObjId($user_id,false);
                        }

                        if ($this->user === false or $this->user->getType() != 'usr')
                        {
                                $this->user =& $ilUser;
                                sendInfo($lng->txt('info_err_user_not_exist'));
                        }
                        else
                        {
                                sendInfo($lng->txt('info_user_view_changed'));
                        }
                }
                
                // get all user roles and all valid roles in scope
                $this->user_roles = $rbacreview->assignedRoles($this->user->getId());
                $this->global_roles = $rbacreview->getGlobalRoles();
                $this->valid_roles = $rbacreview->getParentRoleIds($this->object->getRefId());
                $this->assigned_valid_roles = $this->getAssignedValidRoles();

                $this->getPermissionInfo();
                
                $this->getRoleAssignmentInfo();
                
                $this->getObjectSummary();

        }

Here is the call graph for this function:


Field Documentation

ilObjectStatusGUI::$cmd

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

Referenced by getObjectSummary().

ilObjectStatusGUI::$ctrl

Definition at line 43 of file class.ilObjectStatusGUI.php.

ilObjectStatusGUI::$cur_ref_id

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

ilObjectStatusGUI::$ilias

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

Referenced by getObjectSummary(), and ilObjectStatusGUI().

ilObjectStatusGUI::$lng
ilObjectStatusGUI::$mode

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

ilObjectStatusGUI::$rbacsystem

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

ilObjectStatusGUI::$tpl
ilObjectStatusGUI::$tree

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

Referenced by getRoleAssignmentInfo().


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