Menu

Portal modify/edit interface

Sean Guo
2025-09-22
2025-10-22
  • Sean Guo

    Sean Guo - 2025-09-22

    Hello,

    I have been testing/playing with portals recently and I am wondering if it's possible to have the same ability to edit an object in the portal interface as the regular interface. I am asking this because in the regular interface I was able to edit all the non read-only fields from a class but not in the portal interface even though I specified <opening_mode>edit</opening_mode> in my brick setup like below:

    <brick id="locs" xsi:type="Combodo\iTop\Portal\Brick\ManageBrick"
              _delta="define">
              <active>true</active>
              <rank>
                <default>13</default>
              </rank>
              <width>6</width>
              <title>
                <default>Brick:Portal:UserProfile:locs</default>
              </title>
              <description>Brick:Portal:UserProfile:locs+</description>
              <decoration_class>
                <default>fc fc-ongoing-request fc-2x</default>
              </decoration_class>
              <oql><![CDATA[SELECT Location]]></oql>
              <opening_target>modal</opening_target>
              <opening_mode>edit</opening_mode>
              <fields>
                <field id="name" />
              </fields>
              <grouping>
                <!-- Mandatory -->
                <tabs>
                  <show_tab_counts>true</show_tab_counts>
                  <groups>
                    <group id="opened">
                      <rank>1</rank>
                      <title>Brick:Portal:OngoingRequests:Tab:OnGoing</title>
                      <condition><![CDATA[SELECT Location]]></condition>
                    </group>
                    <group id="resolved">
                      <rank>2</rank>
                      <title>Brick:Portal:OngoingRequests:Tab:Resolved</title>
                      <condition><![CDATA[SELECT Location]]></condition>
                    </group>
                  </groups>
                </tabs>
              </grouping>
              <data_loading>full</data_loading>
              <export>
                <export_default_fields>true</export_default_fields>
              </export>
     </brick>
    

    I made sure the user profile has the full access to the Location class and still there are no editable fields presented in the portal. I would appreciate if someone can provide some insight on this topic!

     
  • Vincent @ Combodo

    Out of the box, in the standard portal, there is no scope defined for the Location class.
    It is not enough to define a Brick, you should also
    * Define a Form, to specify which fields of the Location you want to display and allow to edit
    * Define the Scope read and write for the Location Class

    Remember that out of the box in a Portal nothing is allowed unless you explicitly allow it.

    There are tutorials on how to adapt the Portal, but it's clearly not the easiest part...

     
    • ines

      ines - 2025-10-20

      Hi Vincent,

      I have a similar question. I created a new brick to display pc infos in portal interface. I want some PC attributes (move2production, purchase_date, end_of_warranty) to be in edit mode. Below is part of my portal datamodel. I created a new profile which has right to edit PC class and added the test user account to this profil. I put oql_edit for PC class as you can see as below. I removed "read_only" flage for the dates. But I have error as attached. Could you advise what is missing ?

      <?xml version="1.0" encoding="UTF-8"?>
      <itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.6">
          <module_designs>
              <module_design id="itop-portal" xsi:type="portal" _delta="merge">
                  <bricks>
                      <brick id="inventory-for-portal-users" xsi:type="Combodo\iTop\Portal\Brick\ManageBrick" _delta="define">
                          <active>true</active>
                          <rank>
                              <navigation_menu>60</navigation_menu>
                          </rank>
                          <width>6</width>
                          <title>
                              <default>Inventaire</default>
                          </title>
                          <decoration_class>
                              <default>fc fas fa-warehouse fc-2x</default>
                          </decoration_class>
                          <oql><![CDATA[SELECT FunctionalCI WHERE finalclass IN ('Server','PC')]]></oql>
                          <fields>
                              <field id="finalclass"/>
                          </fields>
                          <display_modes>
                              <!-- How the data can be displayed in the ManageBrick -->
                              <availables>
                                  <mode id="list"/>
                                  <mode id="pie-chart"/>
                                  <mode id="bar-chart"/>
                              </availables>
                              <default>list</default>
                          </display_modes>
                          <grouping>
                              <tabs>
                                  <show_tab_counts>true</show_tab_counts>
                                  <groups>
                                      <group id="Server">
                                          <rank>2</rank>
                                          <title>Serveur</title>
                                          <condition><![CDATA[SELECT FunctionalCI WHERE finalclass='Server']]></condition>
                                      </group>
                                      <group id="PC">
                                          <rank>1</rank>
                                          <title>Postes de travail</title>
                                          <condition><![CDATA[SELECT FunctionalCI WHERE finalclass='PC']]></condition>
                                      </group>
                                  </groups>
                              </tabs>
                          </grouping>
                          <data_loading>auto</data_loading>
                          <export>
                              <export_default_fields>true</export_default_fields>
                          </export>
                      </brick>
                  </bricks>
                  <forms>
                      <form id="pc-view">
                          <class>PC</class>
                          <fields/>
                          <twig _delta="define">
                              <div class="row">
                                  <div class="col-sm-6">
                                      <fieldset>
                                          <legend>{{'PC:system'|dict_s}}</legend>
                                          <div class="col-sm-6">
                                              <div class="form_field" data-field-id="osfamily_id" data-field-flags="read_only"/>
                                              <div class="form_field" data-field-id="osversion_id" data-field-flags="read_only"/>
                                              </div>
                                      </fieldset>
                                  </div>
                                  <div class="col-sm-12">
                                      <fieldset>
                                          <legend>{{'Server:moreinfo'|dict_s}}</legend>
                                          <div class="col-sm-6">
                                              <div class="form_field" data-field-id="move2production"/>
                                              <div class="form_field" data-field-id="purchase_date"/>
                                          </div>
                                          <div class="col-sm-6">
                                              <div class="form_field" data-field-id="end_of_warranty"/>
                                              <div class="form_field" data-field-id="description" data-field-flags="read_only"/>
                                          </div>
                                      </fieldset>
                                      </div>
                              </div>
                          </twig>
                          <modes>
                              <mode id="edit"/>
                              <mode id="view"/>
                          </modes>
                      </form>
                  </forms>
                  <classes>
                      <class id="PC" _delta="merge">
                          <scopes>
                              <scope id="all">
                                  <oql_view><![CDATA[SELECT PC]]></oql_view>
                                  <oql_edit><![CDATA[SELECT PC]]></oql_edit>
                                  <allowed_profiles>
                                      <allowed_profil id= "Portal User Inventory"></allowed_profil>
                                  </allowed_profiles>
                              </scope>
                          </scopes>
                      </class>
                      <class id="FunctionalCI" _delta="define">
                          <scopes>
                              <scope id="all">
                                  <oql_view><![CDATA[SELECT FunctionalCI JOIN Organization ON FunctionalCI.org_id=Organization.id WHERE Organization.id= :current_contact->org_id]]></oql_view>
                              </scope>
                          </scopes>
                      </class>
                  </classes>
              </module_design>
          </module_designs>
      </itop_design>
      
       

      Last edit: ines 2025-10-20
  • Vincent @ Combodo

    You might have to add a oql_edit scope on FunctionalCI with
    SELECT FunctionalCI WHERE finalclass='PC'

    Have you checked the grant matrix of your User, to see if they can read and modify those FunctionalCI and PC objects?
    The scopes are just a restriction of a rights which must exists on the Profile(s)

     

Log in to post a comment.