Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-6216

Component permissions not found due to broken lookup by name instead of id

XMLWordPrintable

    • Sprint 5 (Basel)
    • 8

      When ComponentElement determines if a user can delete/move/write etc a certain component it will find the definition for the area it is placed in and then lookup the component in its available components map. It does this lookup using the components name instead of its id.

      if (areaDefinition != null) {
          String name = componentDefinition.getName();
          ComponentAvailability componentAvailability = areaDefinition.getAvailableComponents().get(name);
          if (componentAvailability != null && componentAvailability.getPermissions() != null) {
              permissions = componentAvailability.getPermissions();
              user = MgnlContext.getUser();
          }
      }
      

      Instead of looking it up by name in the name it should loop the map's entries and find it by id.

      When no name is explicitly configured a template gets its name set by Content2Bean automatically. Content2Bean uses the name of the node it reads it from. So a component with id: module:components/small/text gets the name text.

      This bug means that's impossible to set permissions differently for two components that both have the name text. It also means that the names of the content nodes below availableComponents are significant.

      For Blossom templates this bug makes it impossible to set permissions at all since Blossom templates have no name set.

        Acceptance criteria

              trang.truong Trang Truong
              tmattsson Tobias Mattsson
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD

                    Estimated:
                    Original Estimate - 1d Original Estimate - 1d
                    1d
                    Remaining:
                    Remaining Estimate - 0d
                    0d
                    Logged:
                    Time Spent - 4d
                    4d