Cool, Thanks Francis. I will try
LT Citando Francis Lachapelle <[email protected]>:
Hi Luis On 2013-08-23, at 4:56 AM, luis torres <[email protected]> wrote:Found it but my skill as dev are #$%# :) Im trying to excecute the function update on Node.pm eveytime I change the Role of the node. I include this code on it: if ($result) { if ($previous_node_ref->{status} ne $node_ref->{status}) { # Node has been registered or deregistered reevaluate_access($mac, "node_modify"); } elsif ($luisteste->{category} ne $node_ref->{category}) { # Node has been registered or deregistered reevaluate_access($mac, "node_modify"); $status = $STATUS::INTERNAL_SERVER_ERROR; $result = $teste; } But I cant find how can I compare the db result with the actual Role form field ( hope you understand )I made this patch that we'll probably integrate in the next release. You can try it if you want. It reevaluates the network access if the node status changed or if the role changed *and* the node was *not* registered through 802.1X : diff --git a/html/pfappserver/lib/pfappserver/Model/Node.pm b/html/pfappserver/lib/pfappserver/Model/Node.pm index 1385869..4e620dc 100644 --- a/html/pfappserver/lib/pfappserver/Model/Node.pm +++ b/html/pfappserver/lib/pfappserver/Model/Node.pm @@ -230,7 +230,7 @@ sub update { my ($status, $result) = ($STATUS::OK); my $previous_node_ref; - $previous_node_ref = node_attributes($mac); + $previous_node_ref = node_view($mac); if ($previous_node_ref->{status} ne $node_ref->{status}) { # Status was modified my $option; @@ -247,8 +247,11 @@ sub update { $result = node_modify($mac, %{$node_ref}); } if ($result) { - if ($previous_node_ref->{status} ne $node_ref->{status}) { + my $isDot1x = defined($previous_node_ref->{last_dot1x_username}) && length($previous_node_ref->{last_dot1x_username}) > 0; + if ($previous_node_ref->{status} ne $node_ref->{status} || + $previous_node_ref->{category_id} ne $node_ref->{category_id} && !$isDot1x) { # Node has been registered or deregistered + # or the role has changed and is not currently using 802.1X reevaluate_access($mac, "node_modify"); } }LT Citando Jason Frisvold <[email protected]>:luis torres wrote:Hi mates, what "node_attributes($mac);" resturns?Contextually speaking, it returns the node attributes for the mac address you provide. It shouldn't be that hard to find the function definition and get a definitive answer. > cheersLT-- [email protected] :: +1.514.755.3640 :: http://www.inverse.ca Inverse :: Leaders behind SOGo (http://sogo.nu) and PacketFence (http://packetfence.org) ------------------------------------------------------------------------------ Introducing Performance Central, a new site from SourceForge and AppDynamics. Performance Central is your source for news, insights, analysis and resources for efficient Application Performance Management. Visit us today! http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk _______________________________________________ PacketFence-users mailing list [email protected]https://lists.sourceforge.net/lists/listinfo/packetfence-users
------------------------------------------------------------------------------ Introducing Performance Central, a new site from SourceForge and AppDynamics. Performance Central is your source for news, insights, analysis and resources for efficient Application Performance Management. Visit us today! http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________ PacketFence-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/packetfence-users
