system user | Community
Skip to main content
March 28, 2019
Solved

system user

  • March 28, 2019
  • 15 replies
  • 10444 views

Hi Team,

I have created a systemUser and add the same into user mapper configuration like below

com.adobe.aem.guides.aem-guides-wknd.core:systemUser=systemUser

and getting the same via param.put(ResourceResolverFactory.SUBSERVICE,"systemUser");

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by AEMLearner-1989

Sorry..its my bad...

ResourceResolver resourceResolver = resourceResolverFactory.getServiceResourceResolver(param);

Its working now...

15 replies

Prince_Shivhare
Community Advisor
Community Advisor
March 28, 2019

it seems you forgot to tell the issue?

AEMLearner-1989
March 28, 2019

Can you pls check here

SystemUser issue

smacdonald2008
March 28, 2019

If you having problem with system user and mapping see this. It steps you through it all

Adobe Experience Manager Help | Querying Adobe Experience Manager 6.4 JCR data using the QueryBuilder API

AEMLearner-1989
March 28, 2019

Hi ,

Thanks for your reply .

Can you pls check my query here pls . systemuser is working some java class not for all ..

example :

com.aem.example.core.userTest - Its working ..its giving user id as systemUser

com.aem.example.core.impl.SearchService - Its not working ..its giving anonymous  

Gaurav-Behl
March 28, 2019

Could you validate if your bundle's symbolic name is correct per pom.xml - com.adobe.aem.guides.aem-guides-wknd.core

syntax:

<service-name>[:<subservice-name>]=<authorizable id of a JCR system user>

Could you explain more about "systemuser is working some java class not for all .." ?

AEMLearner-1989
March 28, 2019

Thanks for your reply..

I have created two different java class and try to consume same systemuser in both the class for different purpose.

By default ..this systemuser has all the permission(Read & Write)

com.aem.example.core.userTest.java & com.aem.example.core.impl.SearchService.java

UserTest.java - Its working fine

SearchService - Its throwing a anonymous user

Please find the below screenshot for your reference.

Gaurav-Behl
March 28, 2019

Could you share stacktrace and pom.xml's maven-bundle-plugin snippet?

Did you follow the tutorial as mentioned and tried above link shared by Scott?

AEMLearner-1989
March 28, 2019

HI Team,

core/pom.xml

<?xml version="1.0" encoding="UTF-8"?>

<!--

|  Copyright 2017 Adobe Systems Incorporated

|

|  Licensed under the Apache License, Version 2.0 (the "License");

|  you may not use this file except in compliance with the License.

|  You may obtain a copy of the License at

|

|      http://www.apache.org/licenses/LICENSE-2.0

|

|  Unless required by applicable law or agreed to in writing, software

|  distributed under the License is distributed on an "AS IS" BASIS,

|  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

|  See the License for the specific language governing permissions and

|  limitations under the License.

-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <parent>

        <groupId>com.adobe.aem.guides</groupId>

        <artifactId>aem-guides-wknd</artifactId>

        <version>0.0.1-SNAPSHOT</version>

        <relativePath>../pom.xml</relativePath>

    </parent>

    <artifactId>aem-guides-wknd.core</artifactId>

    <packaging>bundle</packaging>

    <name>WKND Sites Project - Core</name>

    <description>Core bundle for WKND Sites Project</description>

    <build>

        <plugins>

            <plugin>

                <groupId>org.apache.sling</groupId>

                <artifactId>maven-sling-plugin</artifactId>

            </plugin>

            <plugin>

                <groupId>org.apache.felix</groupId>

                <artifactId>maven-bundle-plugin</artifactId>

                <extensions>true</extensions>

                <configuration>

                    <instructions>

                        <!-- Import any version of javax.inject, to allow running on multiple versions of AEM -->

                        <Import-Package>javax.inject;version=0.0.0,*</Import-Package>

                        <Sling-Model-Packages>

                            com.adobe.aem.guides.wknd.core

                        </Sling-Model-Packages>

                    </instructions>

                </configuration>

            </plugin>

        </plugins>

    </build>

    <dependencies>

        <!-- OSGi Dependencies -->

        <dependency>

            <groupId>org.osgi</groupId>

            <artifactId>osgi.core</artifactId>

        </dependency>

        <dependency>

            <groupId>org.osgi</groupId>

            <artifactId>osgi.cmpn</artifactId>

        </dependency>

        <dependency>

            <groupId>org.osgi</groupId>

            <artifactId>osgi.annotation</artifactId>

        </dependency>

        <!-- Other Dependencies -->

        <dependency>

            <groupId>org.slf4j</groupId>

            <artifactId>slf4j-api</artifactId>

        </dependency>

        <dependency>

            <groupId>javax.jcr</groupId>

            <artifactId>jcr</artifactId>

        </dependency>

        <dependency>

            <groupId>javax.servlet</groupId>

            <artifactId>servlet-api</artifactId>

        </dependency>

        <dependency>

            <groupId>com.adobe.aem</groupId>

            <artifactId>uber-jar</artifactId>

            <classifier>apis</classifier>

        </dependency>

        <dependency>

            <groupId>org.apache.sling</groupId>

            <artifactId>org.apache.sling.models.api</artifactId>

        </dependency>

        <dependency>

            <groupId>junit</groupId>

            <artifactId>junit</artifactId>

        </dependency>

        <dependency>

            <groupId>org.mockito</groupId>

            <artifactId>mockito-core</artifactId>

        </dependency>

        <dependency>

            <groupId>junit-addons</groupId>

            <artifactId>junit-addons</artifactId>

        </dependency>

        <dependency>

            <groupId>org.apache.sling</groupId>

            <artifactId>org.apache.sling.testing.sling-mock</artifactId>

        </dependency>

        <dependency>

            <groupId>uk.org.lidalia</groupId>

            <artifactId>slf4j-test</artifactId>

        </dependency>

    </dependencies>

</project>

smacdonald2008
March 28, 2019

Are both your Java classes in the same OSGi bundle - if they are in different bundles - that could be the issue.

AEMLearner-1989
March 28, 2019

Both are same in bundle...am i getting systemUser for class A and anonymous user for class B.

And also we are facing one more issue.. If i create a new package with existing maven project...its not getting deployed.. Anything i am missing here?