Inheritance diagram for ilObjRole:
Collaboration diagram for ilObjRole:Public Member Functions | |
| ilObjRole ($a_id=0, $a_call_by_reference=false) | |
| Constructor public. | |
| toggleAssignUsersStatus ($a_assign_users) | |
| getAssignUsersStatus () | |
| _getAssignUsersStatus ($a_role_id) | |
| read () | |
| loads "role" from database private | |
| assignData ($a_data) | |
| loads a record "role" from array public | |
| update () | |
| updates a record "role" and write it into database public | |
| create () | |
| create | |
| setAllowRegister ($a_allow_register) | |
| set allow_register of role | |
| getAllowRegister () | |
| get allow_register | |
| _lookupRegisterAllowed () | |
| get all roles that are activated in user registration | |
| _lookupAllowRegister ($a_role_id) | |
| check whether role is allowed in user registration or not | |
| setParent ($a_parent_ref) | |
| set reference id of parent object this is neccessary for non RBAC protected objects!!! | |
| getParent () | |
| get reference id of parent object | |
| delete () | |
| delete role and all related data | |
| getCountMembers () | |
| _getTranslation ($a_role_title) | |
| _updateAuthMode ($a_roles) | |
| _getAuthMode ($a_role_id) | |
| __getPermissionDefinitions () | |
Static Public Member Functions | |
| _search (&$a_search_obj) | |
| STATIC METHOD search for role data. | |
| static | _getRolesByAuthMode ($a_auth_mode) |
| Get roles by auth mode. | |
| static | _resetAuthMode ($a_auth_mode) |
| Reset auth mode to default. | |
Data Fields | |
| $parent | |
| $allow_register | |
| $assign_users | |
Class ilObjRole.
Definition at line 34 of file class.ilObjRole.php.
| ilObjRole::__getPermissionDefinitions | ( | ) |
Definition at line 494 of file class.ilObjRole.php.
References ilObject::$lng.
{
global $ilDB, $lng, $objDefinition;
// build array with all rbac object types
$q = "SELECT ta.typ_id,obj.title,ops.ops_id,ops.operation FROM rbac_ta AS ta ".
"JOIN object_data AS obj ON obj.obj_id=ta.typ_id ".
"JOIN rbac_operations AS ops ON ops.ops_id=ta.ops_id";
$r = $ilDB->query($q);
while ($row = $r->fetchRow(DB_FETCHMODE_OBJECT))
{
if($objDefinition->getDevMode($row->title))
{
continue;
}
// FILTER SUBOJECTS OF adm OBJECT
#if(in_array($row->title,$to_filter))
#{
# continue;
#}
$rbac_objects[$row->typ_id] = array("obj_id" => $row->typ_id,
"type" => $row->title
);
$rbac_operations[$row->typ_id][$row->ops_id] = array(
"ops_id" => $row->ops_id,
"title" => $row->operation,
"name" => $lng->txt($row->title."_".$row->operation)
);
}
return array($rbac_objects,$rbac_operations);
}
| ilObjRole::_getAssignUsersStatus | ( | $ | a_role_id | ) |
Definition at line 69 of file class.ilObjRole.php.
References $res.
Referenced by ilObjUserGUI::createObject(), ilRbacReview::getGlobalAssignableRoles(), ilObjUserFolderGUI::importUserRoleAssignmentObject(), ilSoapUserAdministration::importUsers(), ilObjUserFolderGUI::importUsersObject(), and ilSoapUserAdministration::isPermittedRole().
{
global $ilDB;
$query = "SELECT assign_users FROM role_data WHERE role_id = ".$ilDB->quote($a_role_id)." ";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
return $row->assign_users ? true : false;
}
return false;
}
Here is the caller graph for this function:| ilObjRole::_getAuthMode | ( | $ | a_role_id | ) |
Definition at line 443 of file class.ilObjRole.php.
{
global $ilDB;
$q = "SELECT auth_mode FROM role_data ".
"WHERE role_id= ".$ilDB->quote($a_role_id)." ";
$r = $ilDB->query($q);
$row = $r->fetchRow();
return $row[0];
}
| static ilObjRole::_getRolesByAuthMode | ( | $ | a_auth_mode | ) | [static] |
Get roles by auth mode.
public
| string | auth mode |
Definition at line 462 of file class.ilObjRole.php.
References $res.
Referenced by ilRadiusSettings::read().
{
global $ilDB;
$query = "SELECT * FROM role_data ".
"WHERE auth_mode = ".$ilDB->quote($a_auth_mode);
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$roles[] = $row->role_id;
}
return $roles ? $roles : array();
}
Here is the caller graph for this function:| ilObjRole::_getTranslation | ( | $ | a_role_title | ) |
Definition at line 408 of file class.ilObjRole.php.
References ilObject::$lng.
Referenced by ilObjCourseGUI::editMemberObject(), ilObjRoleGUI::editObject(), ilObjectStatusGUI::getAssignedValidRoles(), ilObjGroup::getLocalGroupRoles(), ilObjiLincCourse::getLocalRoles(), ilObjiLincCourse::getMemberRolesTitle(), ilObjGroup::getMemberRolesTitle(), ilObjectStatusGUI::getRoleAssignmentInfo(), ilObjCourseGUI::mailMembersObject(), ilObjGroupGUI::mailMembersObject(), ilPermissionGUI::perm(), ilObjRoleTemplateGUI::permObject(), ilObjRoleGUI::permObject(), ilObjUserGUI::roleassignmentObject(), ilSoapRoleObjectXMLWriter::start(), and ilObjRoleFolderGUI::viewObject().
{
global $lng;
$test_str = explode('_',$a_role_title);
if ($test_str[0] == 'il')
{
$test2 = (int) $test_str[3];
if ($test2 > 0)
{
unset($test_str[3]);
}
return $lng->txt(implode('_',$test_str));
}
return $a_role_title;
}
Here is the caller graph for this function:| ilObjRole::_lookupAllowRegister | ( | $ | a_role_id | ) |
check whether role is allowed in user registration or not
| int | $a_role_id role id |
Definition at line 226 of file class.ilObjRole.php.
Referenced by ilRegistrationGUI::__validateRole(), and ilRegistrationSettingsGUI::editRoles().
{
global $ilDB;
$q = "SELECT * FROM role_data ".
" WHERE role_id =".$ilDB->quote($a_role_id);
$role_set = $ilDB->query($q);
if ($role_rec = $role_set->fetchRow(DB_FETCHMODE_ASSOC))
{
if ($role_rec["allow_register"])
{
return true;
}
}
return false;
}
Here is the caller graph for this function:| ilObjRole::_lookupRegisterAllowed | ( | ) |
get all roles that are activated in user registration
public
Definition at line 199 of file class.ilObjRole.php.
Referenced by ilRegistrationSettingsGUI::__prepareAccessLimitationRoleList(), ilRegistrationSettingsGUI::__prepareRoleList(), ilRegistrationGUI::__showRoleSelection(), ilObjAuthSettingsGUI::authSettingsObject(), ilRegistrationSettingsGUI::editRoleAccessLimitations(), and ilRegistrationSettingsGUI::saveRoleAccessLimitations().
{
global $ilDB;
$q = "SELECT * FROM role_data ".
"LEFT JOIN object_data ON object_data.obj_id = role_data.role_id ".
"WHERE allow_register = 1";
$r = $ilDB->query($q);
$roles = array();
while ($role = $r->fetchRow(DB_FETCHMODE_ASSOC))
{
$roles[] = array("id" => $role["obj_id"],
"title" => $role["title"],
"auth_mode" => $role['auth_mode']);
}
return $roles;
}
Here is the caller graph for this function:| static ilObjRole::_resetAuthMode | ( | $ | a_auth_mode | ) | [static] |
Reset auth mode to default.
public
| string | auth mode |
Definition at line 484 of file class.ilObjRole.php.
Referenced by ilRadiusSettings::save().
{
global $ilDB;
$query = "UPDATE role_data SET auth_mode = 'default' WHERE auth_mode = ".$ilDB->quote($a_auth_mode);
$ilDB->query($query);
}
Here is the caller graph for this function:| ilObjRole::_search | ( | &$ | a_search_obj | ) | [static] |
STATIC METHOD search for role data.
This method is called from class.ilSearch This method used by class.ilSearchGUI.php to a link to the results
| object | object of search class public |
Definition at line 380 of file class.ilObjRole.php.
References $ilBench, and $res.
Referenced by ilSearch::performSearch().
{
global $ilBench;
// NO CLASS VARIABLES IN STATIC METHODS
$where_condition = $a_search_obj->getWhereCondition("like",array("title","description"));
//$in = $a_search_obj->getInStatement("ore.ref_id");
$query = "SELECT obj_id FROM object_data AS od ".
$where_condition." ".
"AND od.type = 'role' ";
$ilBench->start("Search", "ilObjRole_search");
$res = $a_search_obj->ilias->db->query($query);
$ilBench->stop("Search", "ilObjRole_search");
$counter = 0;
while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$result_data[$counter++]["id"] = $row->obj_id;
}
return $result_data ? $result_data : array();
}
Here is the caller graph for this function:| ilObjRole::_updateAuthMode | ( | $ | a_roles | ) |
Definition at line 430 of file class.ilObjRole.php.
Referenced by ilRadiusSettings::save(), and ilObjAuthSettingsGUI::updateAuthRolesObject().
{
global $ilDB;
foreach ($a_roles as $role_id => $auth_mode)
{
$q = "UPDATE role_data SET ".
"auth_mode= ".$ilDB->quote($auth_mode)." ".
"WHERE role_id= ".$ilDB->quote($role_id)." ";
$ilDB->query($q);
}
}
Here is the caller graph for this function:| ilObjRole::assignData | ( | $ | a_data | ) |
loads a record "role" from array public
| array | roledata |
Definition at line 114 of file class.ilObjRole.php.
References setAllowRegister(), ilObject::setDescription(), ilObject::setTitle(), ilUtil::stripSlashes(), and toggleAssignUsersStatus().
Referenced by read().
{
$this->setTitle(ilUtil::stripSlashes($a_data["title"]));
$this->setDescription(ilUtil::stripslashes($a_data["desc"]));
$this->setAllowRegister($a_data["allow_register"]);
$this->toggleAssignUsersStatus($a_data['assign_users']);
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjRole::create | ( | ) |
create
public
Reimplemented from ilObject.
Definition at line 151 of file class.ilObjRole.php.
References getAllowRegister(), and getAssignUsersStatus().
{
global $ilDB;
$this->id = parent::create();
$q = "INSERT INTO role_data ".
"(role_id,allow_register,assign_users) ".
"VALUES ".
"(".$ilDB->quote($this->id).",".$ilDB->quote($this->getAllowRegister()).",".$ilDB->quote($this->getAssignUsersStatus()).")";
$this->ilias->db->query($q);
return $this->id;
}
Here is the call graph for this function:| ilObjRole::delete | ( | ) |
delete role and all related data
public
Reimplemented from ilObject.
Definition at line 275 of file class.ilObjRole.php.
References ilLDAPRoleGroupMappingSettings::_deleteByRole(), ilObject::_exists(), ilObject::getId(), and getParent().
{
global $rbacadmin, $rbacreview,$ilDB;
$role_folders = $rbacreview->getFoldersAssignedToRole($this->getId());
if ($rbacreview->isAssignable($this->getId(),$this->getParent()))
{
// do not delete role if this role is the last role a user is assigned to
// first fetch all users assigned to role
//echo "<br>role id:".$this->getId().":";
$user_ids = $rbacreview->assignedUsers($this->getId());
$last_role_user_ids = array();
foreach ($user_ids as $user_id)
{
//echo "<br>user id:".$user_id.":";
// get all roles each user has
$role_ids = $rbacreview->assignedRoles($user_id);
// is last role?
if (count($role_ids) == 1)
{
$last_role_user_ids[] = $user_id;
}
}
// users with last role found?
if (count($last_role_user_ids) > 0)
{
foreach ($last_role_user_ids as $user_id)
{
//echo "<br>last role for user id:".$user_id.":";
// GET OBJECT TITLE
$tmp_obj = $this->ilias->obj_factory->getInstanceByObjId($user_id);
$user_names[] = $tmp_obj->getFullname();
unset($tmp_obj);
}
// TODO: This check must be done in rolefolder object because if multiple
// roles were selected the other roles are still deleted and the system does not
// give any feedback about this.
$users = implode(', ',$user_names);
$this->ilias->raiseError($this->lng->txt("msg_user_last_role1")." ".
$users."<br/>".$this->lng->txt("msg_user_last_role2"),$this->ilias->error_obj->WARNING);
}
else
{
// IT'S A BASE ROLE
$rbacadmin->deleteRole($this->getId(),$this->getParent());
// Delete ldap role group mappings
include_once('Services/LDAP/classes/class.ilLDAPRoleGroupMappingSettings.php');
ilLDAPRoleGroupMappingSettings::_deleteByRole($this->getId());
// delete object_data entry
parent::delete();
// delete role_data entry
$q = "DELETE FROM role_data WHERE role_id = ".$ilDB->quote($this->getId())." ";
$this->ilias->db->query($q);
include_once './classes/class.ilRoleDesktopItem.php';
$role_desk_item_obj =& new ilRoleDesktopItem($this->getId());
$role_desk_item_obj->deleteAll();
}
}
else
{
// linked local role: INHERITANCE WAS STOPPED, SO DELETE ONLY THIS LOCAL ROLE
$rbacadmin->deleteLocalRole($this->getId(),$this->getParent());
}
// purge empty rolefolders
foreach ($role_folders as $rolf)
{
if (ilObject::_exists($rolf,true))
{
$rolfObj = $this->ilias->obj_factory->getInstanceByRefId($rolf);
$rolfObj->purge();
unset($roleObj);
}
}
return true;
}
Here is the call graph for this function:| ilObjRole::getAllowRegister | ( | ) |
get allow_register
public
Definition at line 188 of file class.ilObjRole.php.
Referenced by create().
{
return $this->allow_register;
}
Here is the caller graph for this function:| ilObjRole::getAssignUsersStatus | ( | ) |
Definition at line 64 of file class.ilObjRole.php.
Referenced by create(), and update().
{
return $this->assign_users;
}
Here is the caller graph for this function:| ilObjRole::getCountMembers | ( | ) |
Definition at line 365 of file class.ilObjRole.php.
{
global $rbacreview;
return count($rbacreview->assignedUsers($this->getId()));
}
| ilObjRole::getParent | ( | ) |
get reference id of parent object
public
Definition at line 263 of file class.ilObjRole.php.
Referenced by delete().
{
return $this->parent;
}
Here is the caller graph for this function:| ilObjRole::ilObjRole | ( | $ | a_id = 0, |
|
| $ | a_call_by_reference = false | |||
| ) |
Constructor public.
| integer | reference_id or object_id | |
| boolean | treat the id as reference_id (true) or object_id (false) |
Definition at line 54 of file class.ilObjRole.php.
References ilObject::ilObject().
{
$this->type = "role";
$this->ilObject($a_id,$a_call_by_reference);
}
Here is the call graph for this function:| ilObjRole::read | ( | ) |
loads "role" from database private
Definition at line 87 of file class.ilObjRole.php.
References $data, and assignData().
Referenced by update().
{
global $ilDB;
$q = "SELECT * FROM role_data WHERE role_id= ".$ilDB->quote($this->id)." ";
$r = $this->ilias->db->query($q);
if ($r->numRows() > 0)
{
$data = $r->fetchRow(DB_FETCHMODE_ASSOC);
// fill member vars in one shot
$this->assignData($data);
}
else
{
$this->ilias->raiseError("<b>Error: There is no dataset with id ".$this->id."!</b><br />class: ".get_class($this)."<br />Script: ".__FILE__."<br />Line: ".__LINE__, $this->ilias->FATAL);
}
parent::read();
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilObjRole::setAllowRegister | ( | $ | a_allow_register | ) |
set allow_register of role
public
| integer |
Definition at line 172 of file class.ilObjRole.php.
Referenced by assignData().
{
if (empty($a_allow_register))
{
$a_allow_register == 0;
}
$this->allow_register = (int) $a_allow_register;
}
Here is the caller graph for this function:| ilObjRole::setParent | ( | $ | a_parent_ref | ) |
set reference id of parent object this is neccessary for non RBAC protected objects!!!
public
| integer | ref_id of parent object |
Definition at line 252 of file class.ilObjRole.php.
{
$this->parent = $a_parent_ref;
}
| ilObjRole::toggleAssignUsersStatus | ( | $ | a_assign_users | ) |
Definition at line 60 of file class.ilObjRole.php.
Referenced by assignData().
{
$this->assign_users = (int) $a_assign_users;
}
Here is the caller graph for this function:| ilObjRole::update | ( | ) |
updates a record "role" and write it into database public
Reimplemented from ilObject.
Definition at line 126 of file class.ilObjRole.php.
References getAssignUsersStatus(), and read().
{
global $ilDB;
$q = "UPDATE role_data SET ".
"allow_register= ".$ilDB->quote($this->allow_register).", ".
"assign_users = ".$ilDB->quote($this->getAssignUsersStatus())." ".
"WHERE role_id= ".$ilDB->quote($this->id)." ";
$this->ilias->db->query($q);
parent::update();
$this->read();
return true;
}
Here is the call graph for this function:| ilObjRole::$allow_register |
Definition at line 45 of file class.ilObjRole.php.
| ilObjRole::$assign_users |
Definition at line 46 of file class.ilObjRole.php.
| ilObjRole::$parent |
Definition at line 43 of file class.ilObjRole.php.
1.7.1