Freeside:1.9:Documentation:Developer:Agent-virtualized Config

From Freeside
Revision as of 20:36, 8 October 2007 by Ivan (talk | contribs) (Introduction)

Jump to: navigation, search

Introduction

Quick notes on how to agent-virtualize a new aspect of the config (typically part_* tables), written up when agent-virtualizing package definitions (part_pkg).

Schema.pm

  • Add agentnum to the table.

AccessRight.pm

Add access rights:

  • "Edit NNN"
  • "Edit global NNN"

part_TABLE.pm

Edit the part_TABLE.pm (or whatever) module itself.

browse/table

  • Move to new browse template if necessary
  • Add to options:
    • agent_virt => 1,
    • agent_null_right => "Edit global NNN"
    • agent_pos => whatever works on the page
  • fix "access deined" check:

   die "access denied"
     unless $FS::CurrentUser::CurrentUser->access_right('Edit NNN')
     || $FS::CurrentUser::CurrentUser->access_right('Edit global NNN')

  • Agent-virtualize count_query
   $FS::CurrentUser::CurrentUser->agentnums_sql(
     'null_right' => 'Edit global NN',
   );
  • If the query param is a normal qsearch hashref (which it probably is if the page already uses elements/browse, or should be if its being moved to elements/broswe), it will agent-virtualize itself from the agent_virt/agent_null_right/agent_pos options.

The hard part

Find all other places this part of the configuration is used (elements/select-part_TABLE, elements/tr-select-part_TABLE?) and agent-virtualize them too.