Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Templates: "noleaf" element ignored => children always (wrongly) allowed #234

Open
sphakka opened this issue Sep 9, 2023 · 0 comments
Open
Labels
old Old version of PLA, may not be fixed.

Comments

@sphakka
Copy link

sphakka commented Sep 9, 2023

Maybe I'm misunderstanding the whole meaning (no doc found here and https://phpldapadmin.sourceforge.net/ looks down): XML templates declaring a noleaf element

<noleaf>1</noleaf>

are intended to prevent creating child objects (i.e., nesting) at creation time. However, this behavior is not honored.

Steps to reproduce

  1. Log into your PLA instance
  2. Go to whatever position in your tree view
  3. Click on 'Create new entry here'
  4. Select a template without a noleaf element, e.g. "Generic: Posix Group"
  5. Create the new object.
  6. Click on the newly created object in the tree view: on the right pane, the 'Create a child entry' is shown when it shouldn't.

Expected behavior
When an XML template is declared as noleaf, PLA should prevent nesting such objects by not showing the 'Create a child entry'. Indeed, lib/TemplateRender.php covers correctly the noleaf case, however, lib/Template.php never sets $noleaf which by default is false.

LDAP Server details (please complete the following information):

  • OS: GNU/Linux Debian 12
  • Server Name: OpenLDAP (slapd v2.5.13+dfsg-5)
  • PLA Version: 1.2.6.3-0.3

Client system:

  • Device: PC
  • OS: GNU/Luinux
  • Browser: Firefox 116.0.3

BTW, the formulation of the noleaf mechanism is hard to crack for my brain ;-) I suggest to rename it to nochild or, even better as it follows:

  1. In lib/Template.php:
    • rename the private attr noleaf => leaf, meaning "I am a leaf template"
    • implement/review the leaf setter/getter
    • rewrite the method isNoLeaf() as isLeaf()
  2. In lib/TemplateRender.php: change the 'childcreate' test in if (.. && ! $this->template->isLeaf())
  3. Document it ;-)
@leenooks leenooks added the old Old version of PLA, may not be fixed. label Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
old Old version of PLA, may not be fixed.
Projects
None yet
Development

No branches or pull requests

2 participants