Menu

Permission denied on new class

Kevin
2024-01-26
2024-01-27
  • Kevin

    Kevin - 2024-01-26

    Hello to all,

    I added a new class on iTop named "Product" with this configuration :

    <class id="Product" _delta="define">
      <parent>cmdbAbstractObject</parent>
      <properties>
        <category>bizmodel,searchable</category>
        <abstract>false</abstract>
        <key_type>autoincrement</key_type>
        <db_table>product</db_table>
        <db_key_field>id</db_key_field>
        <db_final_class_field/>
        <naming>
          <attributes>
            <attribute id="name"/>
          </attributes>
          <complementary_attributes>
            <attribute id="organization_name"></attribute>
            <attribute id="status"></attribute>
          </complementary_attributes>
        </naming>
        <fields_semantic>
          <image_attribute>icon</image_attribute>
          <state_attribute>status</state_attribute>
        </fields_semantic>
        <style>
          <icon>../../images/icons/icons8-product.svg</icon>
        </style>
        <reconciliation>
          <attributes>
            <attribute id="name"/>
            <attribute id="service_id"/>
            <attribute id="service_name"/>
          </attributes>
        </reconciliation>
      </properties>
      <fields>
        <field id="name" xsi:type="AttributeString">
          <sql>name</sql>
          <default_value/>
          <is_null_allowed>false</is_null_allowed>
        </field>
        <field id="service_id" xsi:type="AttributeExternalKey">
          <filter><![CDATA[SELECT Service]]></filter>
          <sql>service_id</sql>
          <target_class>Service</target_class>
          <is_null_allowed></is_null_allowed>
          <on_target_delete>DEL_MANUAL</on_target_delete>
          <allow_target_creation>false</allow_target_creation>
          <display_style>list</display_style>
          <always_load_in_tables>true</always_load_in_tables>
        </field>
        <field id="service_name" xsi:type="AttributeExternalField">
          <extkey_attcode>service_id</extkey_attcode>
          <target_attcode>name</target_attcode>
        </field>
        <field id="status" xsi:type="AttributeEnum">
          <sort_type>rank</sort_type>
          <values>
            <value id="production">
              <code>production</code>
              <rank>10</rank>
            </value>
            <value id="obsolete">
              <code>obsolete</code>
              <rank>20</rank>
            </value>
          </values>
          <sql>status</sql>
          <default_value/>
          <is_null_allowed>true</is_null_allowed>
          <display_style>list</display_style>
        </field>
      </fields>
      <methods/>
      <presentation>
        <details>
          <items>
            <item id="name">
              <rank>10</rank>
            </item>
            <item id="service_id">
              <rank>20</rank>
            </item>
            <item id="status">
              <rank>30</rank>
            </item>
          </items>
        </details>
        <list>
          <items>
            <item id="name">
              <rank>10</rank>
            </item>
            <item id="service_id">
              <rank>20</rank>
            </item>
            <item id="status">
              <rank>30</rank>
            </item>
          </items>
        </list>
        <default_search>
          <items>
            <item id="name">
              <rank>10</rank>
            </item>
            <item id="service_id">
              <rank>20</rank>
            </item>
            <item id="status">
              <rank>30</rank>
            </item>
          </items>
        </default_search>
        <search>
          <items>
            <item id="name">
              <rank>10</rank>
            </item>
            <item id="service_id">
              <rank>20</rank>
            </item>
            <item id="status">
              <rank>30</rank>
            </item>
          </items>
        </search>
        <summary>
          <items>
            <item id="name">
              <rank>10</rank>
            </item>
            <item id="service_id">
              <rank>20</rank>
            </item>
            <item id="status">
              <rank>30</rank>
            </item>
          </items>
        </summary>
      </presentation>
    </class>
    

    And I added the permissions as is :

    <class id="Product">
        <scopes>
            <scope id="product-access" _delta="define">
                <oql_view><![CDATA[SELECT Product]]></oql_view>
                <ignore_silos>true</ignore_silos>
                <allowed_profiles>
                    <allowed_profile id="Portal user" />
                </allowed_profiles>
            </scope>
        </scopes>
    </class>
    

    But when I try to create a new Incident or UserRequest I have the error below :

    Attribute pointing to an object that is either non existing or not readable by the current user: current_object = Incident::-1, attcode = product_id, attvalue = 4, current_user = UserLocal::8
    

    Did I forget a step to allow this?

    Kind regards,

     
  • Kevin

    Kevin - 2024-01-27

    Hello,

    I found my error... Wrong target_class ...

    Kind regards,

     
    👍
    2

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.