Changeset 1324

Show
Ignore:
Timestamp:
01/21/08 13:54:26 (11 months ago)
Author:
benoitg
Message:
  • Fix #42 (Node cannot be renamed)
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wifidog-auth/CHANGELOG

    r1323 r1324  
    11# $Id$ 
     2 
     32008-01-16 Benoit GrĂ©goire  <bock@step.polymtl.ca> 
     4        * Fix #42 (Node cannot be renamed) 
     5         
    262008-01-16 Benoit GrĂ©goire  <bock@step.polymtl.ca> 
    37        * Temporary patch for problem introduced in [1319]:  the menu did not display where main_area_top is empty (which is actually most places in the admin interface).  This shouldn't have been done in the first place, as it doesn't fix the problem the menu cause of theming, and worse causes people to edit MainUI_Display.tpl, causing such errors.  A network config option should have been provided to allow selecting in what area the menu goes. 
  • trunk/wifidog-auth/wifidog/classes/Node.php

    r1322 r1324  
    10351035        $permArray[]=array(Permission::P('NODE_PERM_EDIT_CONFIG'), $this); 
    10361036        $permArray[]=array(Permission::P('NODE_PERM_EDIT_GATEWAY_ID'), $this); 
     1037        $permArray[]=array(Permission::P('NODE_PERM_EDIT_DEPLOYMENT_DATE'), $this); 
    10371038        Security::requireAnyPermission($permArray); 
    10381039        require_once('classes/InterfaceElements.php'); 
     
    10951096 
    10961097        // Name 
    1097         $_title = _("Name"); 
    1098         $_data = InterfaceElements::generateInputText("node_" . $node_id . "_name", $this->getName(), "node_name_input"); 
    1099         $_html_node_information[] = InterfaceElements::generateAdminSectionContainer("node_name", $_title, $_data); 
     1098        $permArray = null; 
     1099        $permArray[]=array(Permission::P('NETWORK_PERM_EDIT_ANY_NODE_CONFIG'), $network); 
     1100        $permArray[]=array(Permission::P('NODE_PERM_EDIT_NAME'), $this); 
     1101        if (Security::hasAnyPermission($permArray)) { 
     1102            $_title = _("Name"); 
     1103            $_data = InterfaceElements::generateInputText("node_" . $node_id . "_name", $this->getName(), "node_name_input"); 
     1104            $_html_node_information[] = InterfaceElements::generateAdminSectionContainer("node_name", $_title, $_data); 
     1105        } 
     1106        else { 
     1107           $_title = _("Name"); 
     1108            $_data = $this->getName(); 
     1109            $_html_node_information[] = InterfaceElements::generateAdminSectionContainer("node_name", $_title, $_data); 
     1110        } 
    11001111 
    11011112        // Creation date 
    11021113        $_title = _("Creation date"); 
    1103         if ($_userIsAdmin) { 
     1114        $permArray = null; 
     1115        $permArray[]=array(Permission::P('NETWORK_PERM_EDIT_ANY_NODE_CONFIG'), $network); 
     1116        $permArray[]=array(Permission::P('NODE_PERM_EDIT_DEPLOYMENT_DATE'), $this); 
     1117        if (Security::hasAnyPermission($permArray)) { 
    11041118            $_data = DateTimeWD::getSelectDateTimeUI(new DateTimeWD($this->getCreationDate()), "node_" . $node_id . "_creation_date", DateTimeWD::INTERFACE_DATETIME_FIELD, "node_creation_date_input"); 
    11051119        } else { 
     
    12641278        $permArray[]=array(Permission::P('NODE_PERM_EDIT_CONFIG'), $this); 
    12651279        $permArray[]=array(Permission::P('NODE_PERM_EDIT_GATEWAY_ID'), $this); 
     1280        $permArray[]=array(Permission::P('NODE_PERM_EDIT_DEPLOYMENT_DATE'), $this); 
    12661281        Security::requireAnyPermission($permArray); 
    12671282        // Check if user is a admin 
     
    12851300 
    12861301        // Name 
    1287         if ($_userIsAdmin) { 
     1302        $permArray = null; 
     1303        $permArray[]=array(Permission::P('NETWORK_PERM_EDIT_ANY_NODE_CONFIG'), $network); 
     1304        $permArray[]=array(Permission::P('NODE_PERM_EDIT_NAME'), $this); 
     1305        if (Security::hasAnyPermission($permArray)) { 
    12881306            $name = "node_".$node_id."_name"; 
    12891307            $this->setName($_REQUEST[$name]); 
    1290         } else { 
    1291             $this->setName($this->getName()); 
    12921308        } 
    12931309 
    12941310        // Creation date 
    1295         if ($_userIsAdmin) { 
     1311       $permArray = null; 
     1312        $permArray[]=array(Permission::P('NETWORK_PERM_EDIT_ANY_NODE_CONFIG'), $network); 
     1313        $permArray[]=array(Permission::P('NODE_PERM_EDIT_DEPLOYMENT_DATE'), $this); 
     1314        if (Security::hasAnyPermission($permArray)) { 
    12961315            $name = "node_".$node_id."_creation_date"; 
    12971316            $this->setCreationDate(DateTimeWD::processSelectDateTimeUI($name, DateTimeWD :: INTERFACE_DATETIME_FIELD)->getIso8601FormattedString()); 
    1298         } else { 
    1299             $this->setCreationDate($this->getCreationDate()); 
    13001317        } 
    13011318 
     
    16231640            } 
    16241641        } 
    1625             if(Security::hasPermission(Permission::P('NETWORK_PERM_ADD_NODE'))){ 
     1642        if(Security::hasPermission(Permission::P('NETWORK_PERM_ADD_NODE'))){ 
    16261643            $items[] = array('path' => 'node/node_add_new', 
    16271644                'title' => sprintf(_("Add a new node")), 
  • trunk/wifidog-auth/wifidog/classes/Permission.php

    r1322 r1324  
    100100             
    101101            $PERMISSIONS['NODE_PERM_EDIT_GATEWAY_ID'] = array(_("User is allowed to change the gateway id of this node"), StakeholderType::Node, false); 
     102            $PERMISSIONS['NODE_PERM_EDIT_NAME'] = array(_("User is allowed to change the public name of this node"), StakeholderType::Node, false); 
     103            $PERMISSIONS['NODE_PERM_EDIT_DEPLOYMENT_DATE'] = array(_("User is allowed to change the deployment date of this node"), StakeholderType::Node, false); 
     104             
    102105            $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); 
    103106