Angela Schreiber created SLING-10235:
----------------------------------------

             Summary: DisableServiceUser does not allow to retriev original 
disable-reason
                 Key: SLING-10235
                 URL: https://issues.apache.org/jira/browse/SLING-10235
             Project: Sling
          Issue Type: Bug
          Components: Repoinit
            Reporter: Angela Schreiber


[~bdelacretaz], during preliminary investigation into SLING-10219 i noticed 
that there is no way to obtain the original disable reason from 
{{DisableServiceUser}} operation.

for the documented example:
{code}
disable service user deprecated_service_user : "Disabled user to make an 
example"
{code}

the jcr-repoinit {{UserVisitor.visitDisableServiceUser}} will do the following:

{code}
    public void visitDisableServiceUser(DisableServiceUser dsu) {
        final String username = dsu.getUsername();
        final String reason = dsu.getParametersDescription();
        [...]
    }
{code}

however, {{DisableServiceUser.getParametersDescription}} looks as follows:

{code}
public String getParametersDescription() {
        StringBuilder sb = new StringBuilder();
        sb.append(super.getParametersDescription());
        if (this.reason != null) {
            sb.append(" : ");
            sb.append(this.reason);
        }

        return sb.toString();
    }
{code}

where {{super.getParametersDescription())}} returns the {{userName}}.

so, the resulting disable reason stored in the repository will be:
"deprecated_service_user : Disabled user to make an example"
instead of
"Disabled user to make an example"

note, that there is no other way to retrieve the original reason (e.g. 
{{DisableServiceUser.getReason()}} which means for SLING-10219 that the 
param-description needs to be parsed again i.e. relying on implementation 
detail, which looks quite wrong.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to