Changeset 3255 for branches/2.2/workflow/inc
- Timestamp:
- 09/15/10 17:06:46 (14 years ago)
- Location:
- branches/2.2/workflow/inc
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/workflow/inc/class.WorkflowLDAP.inc.php
r3221 r3255 562 562 ); 563 563 564 $result = array_merge($result, ldap_get_entries($this->dataSource, $resourceIdentifier)); 564 $entries = ldap_get_entries($this->dataSource, $resourceIdentifier); 565 if (is_array($entries)) { 566 $result = array_merge($result, $entries); 567 } 568 565 569 unset($result['count']); 566 570 } -
branches/2.2/workflow/inc/class.bo_adminaccess.inc.php
r3167 r3255 85 85 return $this->so->getUserNames($admins_id); 86 86 } 87 88 /** 89 * Retorna o nivel administrativo do organograma do processo 90 * 91 * @param array $p processo 92 * @return array o nivel administrativo do monitor do processo 93 * @access public 94 */ 95 function get_organogram_admin_level($p) 96 { 97 return $this->so->getUserAdminLevel('ORG', $p['uid'], $p['pid']); 98 } 87 99 88 100 /** … … 221 233 return null; 222 234 } 235 236 /** 237 * Seta o nivel administrativo do organograma 238 * 239 * @param array $p processo 240 * @return arraym 241 * @access public 242 */ 243 function set_organogram_admin_level($p) 244 { 245 $np = explode('_', $p['np']); 246 $levels = array(); 247 foreach ($np as $pair) 248 { 249 list($key, $value) = explode('=', $pair, 2); 250 $levels[$key] = ($value == '1') ? true : false; 251 } 252 253 254 $result = $this->so->setAdminLevel('ORG', $p['uid'], $p['pid'], $levels); 255 256 if (!$result) { 257 return "Não atualizou as permissões."; 258 } 259 260 } 223 261 224 262 /** -
branches/2.2/workflow/inc/class.so_adminaccess.inc.php
r3167 r3255 184 184 function get_granted_organograms($user_id) 185 185 { 186 return $this->getUserPermissions('ORG', $user_id );186 return $this->getUserPermissions('ORG', $user_id, 0); 187 187 } 188 188 … … 311 311 * @param string $type type of resource 312 312 * @param integer $uid user id 313 * @param requiredLevel Level Required to Access. 313 314 * @return bool 314 315 * @access public 315 316 */ 316 function getUserPermissions($type, $uid )317 function getUserPermissions($type, $uid, $requiredLevel = null) 317 318 { 318 319 $query = " 319 320 SELECT 320 numvalue 321 numvalue, 322 nivel 321 323 FROM 322 324 egw_wf_admin_access … … 329 331 $output = array(); 330 332 if ($result) 331 while ($row = $result->fetchRow()) 332 $output[] = $row['numvalue']; 333 while ($row = $result->fetchRow()) { 334 $authorized = $this->_checkLevelNumber($row['nivel'], $requiredLevel); 335 if (isset($requiredLevel)) { 336 $authorized = $this->checkUserAccessToResource($type,$uid,$row['numvalue'],$requiredLevel); 337 if ($authorized) { 338 $output[] = $row['numvalue']; 339 } 340 } else { 341 $output[] = $row['numvalue']; 342 } 343 } 333 344 334 345 return $output; … … 342 353 * @return array 343 354 */ 344 function getUserGroupPermissions($type, $uid )355 function getUserGroupPermissions($type, $uid, $requiredLevel = null) 345 356 { 346 357 $groups = galaxia_retrieve_user_groups($uid); … … 361 372 $output = array(); 362 373 if ($result) 363 while ($row = $result->fetchRow()) 364 $output[] = $row['numvalue']; 374 while ($row = $result->fetchRow()) { 375 if (isset($requiredLevel)) { 376 //$authorized = $this->_checkLevelNumber($row['nivel'], $requiredLevel); 377 $authorized = $this->checkUserAccessToResource($type,$uid,$row['numvalue'],$requiredLevel); 378 if ($authorized) { 379 $output[] = $row['numvalue']; 380 } 381 } else { 382 $output[] = $row['numvalue']; 383 } 384 } 365 385 366 386 return $output; … … 376 396 function checkUserAccessToType($type, $uid) 377 397 { 378 return (count($this->getUserPermissions($type, $uid )) > 0);398 return (count($this->getUserPermissions($type, $uid,0)) > 0); 379 399 } 380 400 /** … … 414 434 415 435 $result = $this->db->query($query, array($type, $uid, $numvalue)); 436 416 437 $row = $result->fetchRow(); 417 438 418 if (isset($row['nivel'])) 419 return $this->_checkLevelNumber($row['nivel'], $requiredLevel); 439 if (isset($row['nivel'])) { 440 $res = $this->_checkLevelNumber($row['nivel'], $requiredLevel); 441 return $res; 442 } 420 443 else 421 444 return false; … … 491 514 } 492 515 /** 493 * Seta ao nivel de administracao516 * Seta o nivel de administracao 494 517 * 495 518 * @param string $type tipo de recurso … … 505 528 $level = $this->_permissionListToNumber($level); 506 529 507 $query = " 508 UPDATE egw_wf_admin_access 530 $query = "UPDATE egw_wf_admin_access 509 531 SET 510 532 nivel = ? … … 513 535 (tipo = ?) AND 514 536 (numvalue = ?)"; 515 $this->db->query($query, array($level, $uid, $type, $numvalue)); 537 $result = $this->db->query($query, array($level, $uid, $type, $numvalue)); 538 539 return $result; 516 540 } 517 541 -
branches/2.2/workflow/inc/class.so_orgchart.inc.php
r3225 r3255 145 145 else 146 146 { 147 $organizations = $this->acl->getUserPermissions("ORG", $this->userID );147 $organizations = $this->acl->getUserPermissions("ORG", $this->userID, 0); 148 148 $organizations[] = -1; 149 149 $query = "SELECT organizacao_id, nome, descricao, ativa, url_imagem, sitio FROM organizacao WHERE (organizacao_id IN (" . implode(',', $organizations) . ")) ORDER BY nome"; … … 1126 1126 $mobile = ''; 1127 1127 $homePhone = ''; 1128 1128 1129 1129 /* 1130 1130 * Check if the current user can view the mobile and homePhone of the employee … … 1132 1132 * that's being retrieved 1133 1133 */ 1134 if (in_array($account_id,$arr_supervisores) || ($account_id == $employeeID)) { 1134 $authorized = $this->acl->checkUserAccessToResource('ORG', $account_id, (int) $organizationID, 1); 1135 if ((in_array($account_id,$arr_supervisores) || ($account_id == $employeeID)) || ($authorized)) { 1135 1136 $mobile = $employeeEntry['mobile']; 1136 1137 $homePhone = $employeeEntry['homephone']; -
branches/2.2/workflow/inc/class.ui_orgchart.inc.php
r3167 r3255 50 50 51 51 $isAdmin = $this->workflow_acl->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']); 52 $isOrgchartManager = $this->workflow_acl->checkUserGroupAccessToType('ORG', $GLOBALS['phpgw_info']['user']['account_id'] );52 $isOrgchartManager = $this->workflow_acl->checkUserGroupAccessToType('ORG', $GLOBALS['phpgw_info']['user']['account_id'],0); 53 53 54 54 if (!($isAdmin || $isOrgchartManager)) -
branches/2.2/workflow/inc/hook_sidebox_menu.inc.php
r3167 r3255 38 38 39 39 /* check if the user can administrate the orgchart */ 40 if ($workflowACL->checkUserGroupAccessToType('ORG', $userID ) || $isWorkflowAdmin)40 if ($workflowACL->checkUserGroupAccessToType('ORG', $userID,0) || $isWorkflowAdmin) 41 41 $file['Organization Chart'] = $GLOBALS['phpgw']->link('/index.php','menuaction=workflow.ui_orgchart.draw'); 42 42
Note: See TracChangeset
for help on using the changeset viewer.