<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Access denied to com.liferay.portal.kernel.service.UserService#getUserById</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=110743490" />
  <subtitle>Access denied to com.liferay.portal.kernel.service.UserService#getUserById</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=110743490</id>
  <updated>2026-04-04T07:32:25Z</updated>
  <dc:date>2026-04-04T07:32:25Z</dc:date>
  <entry>
    <title>RE: Access denied to com.liferay.portal.kernel.service.UserService#getUserB</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110744627" />
    <author>
      <name>Javier Gamarra</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110744627</id>
    <updated>2018-08-20T20:04:22Z</updated>
    <published>2018-08-20T20:04:22Z</published>
    <summary type="html">&lt;p&gt;Depends on your needs... if the APIs can be public, changing the
  access policy (there are several options to restrict access) is the
  easiest way. But if you want more complex needs, creating a user is
  more flexible (you can disable it in the event of a security issue,
  implement some sort of rate limiting...). It's also way more
  cumbersome (detect which permissions you need, take care of the user,
  embed it...).&lt;/p&gt;</summary>
    <dc:creator>Javier Gamarra</dc:creator>
    <dc:date>2018-08-20T20:04:22Z</dc:date>
  </entry>
  <entry>
    <title>RE: Access denied to com.liferay.portal.kernel.service.UserService#getUserB</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110744604" />
    <author>
      <name>John Cressman</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110744604</id>
    <updated>2018-08-20T20:00:03Z</updated>
    <published>2018-08-20T20:00:03Z</published>
    <summary type="html">&lt;p&gt;What is the preferred way for creating mobile applications that call
  the Liferay APIs?  In the tutorial, there is no mention of creating a
  user that I see.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;John&lt;/p&gt;</summary>
    <dc:creator>John Cressman</dc:creator>
    <dc:date>2018-08-20T20:00:03Z</dc:date>
  </entry>
  <entry>
    <title>RE: Access denied to com.liferay.portal.kernel.service.UserService#getUserB</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110744583" />
    <author>
      <name>Javier Gamarra</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110744583</id>
    <updated>2018-08-20T19:52:09Z</updated>
    <published>2018-08-20T19:52:09Z</published>
    <summary type="html">&lt;p&gt;Liferay default JSON-WS services are private by default (you need an
  authenticated user to access them, either using BASIC, DIGEST,
  OAUTH...). You can make them public with the service access policy as
  you already discovered :)&lt;br /&gt;
  &lt;br /&gt; The error you are receiving right now is because you are trying
  to access the default user (a hidden user called default) that can not
  be queried, it's used only for security reasons. You can access it if
  you enable some permissions but it doesn't make much sense because
  it's not a &amp;quot;normal&amp;quot; user. If you query other user you should
  access the information without issues.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;About the service access policy issue you have 2 approaches, change
  the policy to enable unauthenticated queries or use a user for
  accessing the API with only the permissions you want.&lt;/p&gt;</summary>
    <dc:creator>Javier Gamarra</dc:creator>
    <dc:date>2018-08-20T19:52:09Z</dc:date>
  </entry>
  <entry>
    <title>RE: Access denied to com.liferay.portal.kernel.service.UserService#getUserB</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110744550" />
    <author>
      <name>John Cressman</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110744550</id>
    <updated>2018-08-20T19:07:14Z</updated>
    <published>2018-08-20T19:07:14Z</published>
    <summary type="html">&lt;p&gt;After much searching and researching, it I tried adding the
  com.liferay.portal.kernal.service.UserService#getUserByScreenName to
  the System_Default in Configuration-&amp;gt;Service Access Policy and no
  longer get the Access denied to
  com.liferay.portal.kernal.service.UserService#getUserByScreenName error.&lt;/p&gt;
&lt;p&gt;Instead, I now get: User 20119 must have the VIEW permission to
  com.liferay.portal.kernel.model.User 20155.&lt;/p&gt;
&lt;p&gt;Looking in users, I do see that Test user (the one I try to log in
  with) is 20155, however I cannot find 20119.  In fact, TEST is the
  ONLY user right now.&lt;/p&gt;
&lt;p&gt;So it looks like there is definitely some permissioning issues going
  on.  I don't remember seeing any of this addressed in the tutorial I
  watched.  Is this addressed some place else? &lt;/p&gt;
&lt;p&gt;Anyone else have this issue?&lt;/p&gt;</summary>
    <dc:creator>John Cressman</dc:creator>
    <dc:date>2018-08-20T19:07:14Z</dc:date>
  </entry>
  <entry>
    <title>RE: Access denied to com.liferay.portal.kernel.service.UserService#getUserB</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110743548" />
    <author>
      <name>John Cressman</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110743548</id>
    <updated>2018-08-20T17:23:49Z</updated>
    <published>2018-08-20T17:23:49Z</published>
    <summary type="html">&lt;p&gt;I am calling that from within the Android App, as per the tutorial. 
  I'm not using a web browser any sort.  I'm not calling it as any
  particular user - as far as I can tell - it's using:&lt;/p&gt;
&lt;p&gt;In the layout:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;pre&gt;
&amp;lt;com.liferay.mobile.screens.auth.login.LoginScreenlet
android:id=&amp;quot;@+id/login_screenlet&amp;quot;
android:layout_width=&amp;quot;match_parent&amp;quot;
android:layout_height=&amp;quot;wrap_content&amp;quot;
liferay:basicAuthMethod=&amp;quot;screen_name&amp;quot;
liferay:credentialsStorage=&amp;quot;auto&amp;quot;
liferay:layoutId=&amp;quot;@layout/login_westeros&amp;quot;
/&amp;gt;&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;And in the java:&lt;/p&gt;
&lt;pre&gt;
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    LoginScreenlet loginScreenlet = (LoginScreenlet) findViewById(R.id.login_screenlet);

    loginScreenlet.setListener(this);

}

@Override
public void onLoginSuccess(User user) {

    startActivity(new Intent(MainActivity.this, ActivityOne.class));

}

@Override
public void onLoginFailure(Exception e) {

    Toast.makeText( MainActivity.this,  &amp;quot;!!! LOGIN FAILURE !!!&amp;quot;, Toast.LENGTH_SHORT).show();

}&lt;/pre&gt;
&lt;p&gt;THat's all straight from the tutorial.&lt;/p&gt;</summary>
    <dc:creator>John Cressman</dc:creator>
    <dc:date>2018-08-20T17:23:49Z</dc:date>
  </entry>
  <entry>
    <title>RE: Access denied to com.liferay.portal.kernel.service.UserService#getUserB</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110743522" />
    <author>
      <name>Christoph Rabel</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110743522</id>
    <updated>2018-08-20T17:16:44Z</updated>
    <published>2018-08-20T17:16:44Z</published>
    <summary type="html">&lt;p&gt;Where do you call that? Are you sure that your current user has the
  permission to call that function?&lt;/p&gt;
&lt;p&gt;When you authenticate with that user, can you call getUserById from
  the browser (go to /api/jsonws and try to call that method).&lt;/p&gt;</summary>
    <dc:creator>Christoph Rabel</dc:creator>
    <dc:date>2018-08-20T17:16:44Z</dc:date>
  </entry>
  <entry>
    <title>Access denied to com.liferay.portal.kernel.service.UserService#getUserById</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110743489" />
    <author>
      <name>John Cressman</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=110743489</id>
    <updated>2018-08-20T16:59:36Z</updated>
    <published>2018-08-20T16:59:36Z</published>
    <summary type="html">&lt;p&gt;I am going through the Liferay University tutorial and have built a
  simple Android Studio app that should login to my local instance of Liferay.&lt;/p&gt;
&lt;p&gt;First, it looked like a 7.1 vs 7.0 issue, but now I have 7.0 DXP
  installed and running.  I am point to the correct company_id and group_id's.&lt;/p&gt;
&lt;p&gt;Now, I actually see something in the catalina console when I try to
  login.  The login fails, but on the catalina console I get the
  following error:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;
  &lt;b&gt;Access denied to com.liferay.portal.kernel.service.UserService#getUserById&lt;/b&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;How do I get around this?  This has been a very frustrating
  experience as following the tutorial line by line, my results are not
  what the instructor sees.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</summary>
    <dc:creator>John Cressman</dc:creator>
    <dc:date>2018-08-20T16:59:36Z</dc:date>
  </entry>
</feed>
