Changeset 1355
- Timestamp:
- 06/14/08 22:12:23 (2 months ago)
- Files:
-
- trunk/wifidog-auth/CHANGELOG (modified) (1 diff)
- trunk/wifidog-auth/wifidog/classes/Content/UIAllowedBandwidth/UIAllowedBandwidth.php (modified) (1 diff)
- trunk/wifidog-auth/wifidog/classes/Permission.php (modified) (1 diff)
- trunk/wifidog-auth/wifidog/classes/Role.php (modified) (6 diffs)
- trunk/wifidog-auth/wifidog/classes/Stakeholder.php (modified) (1 diff)
- trunk/wifidog-auth/wifidog/classes/StakeholderType.php (modified) (1 diff)
- trunk/wifidog-auth/wifidog/classes/User.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wifidog-auth/CHANGELOG
r1352 r1355 1 1 # $Id$ 2 2008-06-12 Benoit Grégoire <bock@step.polymtl.ca> 3 * Add NODE_PERM_BYPASS_DYNAMIC_ABUSE_CONTROL permission. User is allowed to exceed dynamic abuse control limits at this node. 4 * Stakeholder selector UI tweaks 5 2 6 2008-06-12 Benoit Grégoire <bock@step.polymtl.ca> 3 7 * Use bigint for dynamic abuse control byte values trunk/wifidog-auth/wifidog/classes/Content/UIAllowedBandwidth/UIAllowedBandwidth.php
r1354 r1355 90 90 } 91 91 /* Format human readable filesize */ 92 static function formatSize($size, $round = 0) {92 static public function formatSize($size, $round = 0) { 93 93 //Size must be bytes! 94 94 $sizes = array(_('B'), _('kB'), _('MB'), _('GB'), _('TB'), _('PB'), _('EB'), _('ZB'), _('YB')); trunk/wifidog-auth/wifidog/classes/Permission.php
r1351 r1355 105 105 106 106 $PERMISSIONS['NODE_PERM_EDIT_CONFIG'] = array(_("TEMPORARY: User is allowed to edit general configuration for this node. This will be replaced with more granular permissions in the future"), StakeholderType::Node, false); 107 107 $PERMISSIONS['NODE_PERM_BYPASS_DYNAMIC_ABUSE_CONTROL'] = array(_("User is allowed to exceed dynamic abuse control limits at this node"), StakeholderType::Node, false); 108 108 109 self::$_permissionArray = $PERMISSIONS; 109 110 } trunk/wifidog-auth/wifidog/classes/Role.php
r1339 r1355 145 145 !empty($userData['stakeholderTypeId'])?$targetObjectClassSql = " AND stakeholder_type_id = '".$db->escapeString($userData['stakeholderTypeId'])."' ":$targetObjectClassSql=null; 146 146 147 $sql = "SELECT role_id, stakeholder_type_id FROM roles WHERE 1=1 $targetObjectClassSql ORDER BY stakeholder_type_id, role_id";147 $sql = "SELECT role_id, role_description_content_id, stakeholder_type_id FROM roles WHERE 1=1 $targetObjectClassSql ORDER BY stakeholder_type_id, role_id"; 148 148 $role_rows = null; 149 149 $db->execSql($sql, $role_rows, false); … … 155 155 $i = 0; 156 156 foreach ($role_rows as $role_row) { 157 $role = self::getObject($role_row['role_id']); 157 158 $tab[$i][0] = $role_row['role_id']; 158 159 empty($userData['stakeholderTypeId'])?$tab[$i][1]=$role_row['stakeholder_type_id'].'; ':$tab[$i][1]=null; 159 $tab[$i][1] .= $role_row['role_id']; 160 161 $tab[$i][1] .= $role->getLabelStr(); 160 162 $i ++; 161 163 } … … 176 178 } 177 179 180 function getLabelStr() { 181 if($this->_row['role_description_content_id']) { 182 $description = Content::getObject($this->_row['role_description_content_id'])->__toString() . ' '; 183 } 184 else { 185 $description = null; 186 } 187 return sprintf("%s (%s) ", $description, $this->id); 188 } 178 189 179 190 /** … … 329 340 array ( 330 341 'isSimpleContent' 331 )342 ) 332 343 ); 333 344 $description_allowed_content_types = ContentTypeFilter :: getObject($criteria_array); … … 472 483 public function delete(& $errmsg) 473 484 { 474 485 475 486 $retval = false; 476 487 if (Security::hasPermission('SERVER_PERM_EDIT_ROLES', Server::getServer())) { … … 502 513 'title' => _("User roles"), 503 514 'url' => BASE_URL_PATH.htmlspecialchars("admin/generic_object_admin.php?object_class=Role&action=list") 504 );515 ); 505 516 } 506 517 return $items; trunk/wifidog-auth/wifidog/classes/Stakeholder.php
r1316 r1355 83 83 foreach ($stakeholder_rows as $stakeholder_row) { 84 84 $user = User::getObject($stakeholder_row['user_id']); 85 if(!empty($stakeholder_row['role_description'])) { 86 $title = htmlspecialchars($stakeholder_row['role_description']); 87 $roleStr = "<a href='#' title='$title'>".$stakeholder_row['role_id'] ."</a>\n"; 88 } 89 else { 90 $roleStr = $stakeholder_row['role_id']; 91 } 85 $role = Role::getObject($stakeholder_row['role_id']); 86 $roleStr = htmlspecialchars($role->getLabelStr()); 92 87 $name = $object_id . "_stakeholder_" . $stakeholder_row['user_id'] . "_". $stakeholder_row['role_id'] . "_remove"; 93 88 $listDataContents = InterfaceElements::generateAdminSection("", $user->getListUI() . ' '. $roleStr, InterfaceElements::generateInputSubmit($name, _("Remove stakeholder"))); trunk/wifidog-auth/wifidog/classes/StakeholderType.php
r1249 r1355 111 111 $i = 0; 112 112 foreach ($rows as $row) { 113 113 114 $tab[$i][0] = $row['stakeholder_type_id']; 114 115 $tab[$i][1] = $row['stakeholder_type_id']; trunk/wifidog-auth/wifidog/classes/User.php
r1351 r1355 587 587 $abuseControlReport = self::getAbuseControlConnectionHistory($user, $mac, $node); 588 588 if($abuseControlReport) { 589 if (!$user) { 590 $user = User::getCurrentUser(); 591 } 589 592 //pretty_print_r($abuseControlReport); 590 591 if($abuseControlReport['network_total_bytes_exceeded_limit']=='t') { 592 $retval .= sprintf(_("During the last %s period, you transfered %d bytes throughout the network, which exceeds the %d bytes limit."), $abuseControlReport['connection_limit_window'], $abuseControlReport['network_total_bytes'], $abuseControlReport['connection_limit_network_max_total_bytes']); 593 } 594 if($abuseControlReport['node_total_bytes_exceeded_limit']=='t') { 595 $retval .= sprintf(_("During the last %s period, you transfered %d bytes at this node, which exceeds the %d bytes limit."), $abuseControlReport['connection_limit_window'], $abuseControlReport['node_total_bytes'], $abuseControlReport['connection_limit_node_max_total_bytes']); 596 } 597 if($abuseControlReport['network_duration_exceeded_limit']=='t') { 598 $retval .= sprintf(_("During the last %s period, you were online for a duration of %s throughout the network, which exceeds the %s limit."), $abuseControlReport['connection_limit_window'], $abuseControlReport['network_duration'], $abuseControlReport['connection_limit_network_max_usage_duration']); 599 } 600 if($abuseControlReport['node_duration_exceeded_limit']=='t') { 601 $retval .= sprintf(_("During the last %s period, you were online for a duration of %s at this node, which exceeds the %s limit."), $abuseControlReport['connection_limit_window'], $abuseControlReport['node_duration'], $abuseControlReport['connection_limit_node_max_usage_duration']); 593 if($node && Security::hasPermission(Permission::P('NODE_PERM_BYPASS_DYNAMIC_ABUSE_CONTROL'), $node, $user)) { 594 $retval = false; 595 } 596 else { 597 require_once('classes/Content/UIAllowedBandwidth/UIAllowedBandwidth.php'); 598 if($abuseControlReport['network_total_bytes_exceeded_limit']=='t') { 599 $retval .= sprintf(_("During the last %s period, you transfered %s bytes throughout the network, which exceeds the %s bytes limit for the entire network."), $abuseControlReport['connection_limit_window'], UIAllowedBandwidth::formatSize($abuseControlReport['network_total_bytes']), UIAllowedBandwidth::formatSize($abuseControlReport['connection_limit_network_max_total_bytes'])); 600 } 601 if($abuseControlReport['node_total_bytes_exceeded_limit']=='t') { 602 $retval .= sprintf(_("During the last %s period, you transfered %s bytes at this node, which exceeds the %s bytes limit for this node."), $abuseControlReport['connection_limit_window'], UIAllowedBandwidth::formatSize($abuseControlReport['node_total_bytes']), UIAllowedBandwidth::formatSize($abuseControlReport['connection_limit_node_max_total_bytes'])); 603 } 604 if($abuseControlReport['network_duration_exceeded_limit']=='t') { 605 $retval .= sprintf(_("During the last %s period, you were online for a duration of %s throughout the network, which exceeds the %s limit for the entire network."), $abuseControlReport['connection_limit_window'], $abuseControlReport['network_duration'], $abuseControlReport['connection_limit_network_max_usage_duration']); 606 } 607 if($abuseControlReport['node_duration_exceeded_limit']=='t') { 608 $retval .= sprintf(_("During the last %s period, you were online for a duration of %s at this node, which exceeds the %s limit for this node."), $abuseControlReport['connection_limit_window'], $abuseControlReport['node_duration'], $abuseControlReport['connection_limit_node_max_usage_duration']); 609 } 602 610 } 603 611 }
