<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Get all accesssible document of a user while being authenticated as Administrator PYTHON API in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/get-all-accesssible-document-of-a-user-while-being-authenticated/m-p/325287#M12288</link>
    <description>&lt;P&gt;Yes something like that, but i can't figure how to use it&lt;/P&gt;</description>
    <pubDate>Tue, 16 Feb 2021 15:21:05 GMT</pubDate>
    <dc:creator>De_Grossi_Hugo</dc:creator>
    <dc:date>2021-02-16T15:21:05Z</dc:date>
    <item>
      <title>Get all accesssible document of a user while being authenticated as Administrator PYTHON API</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/get-all-accesssible-document-of-a-user-while-being-authenticated/m-p/325282#M12283</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I'm using the Nuxeo Python API with Nuxeo 10.10 and want to know if there is any way to fetch all accessible document while log as administrator. I've already find a way, but it's a bit tricky and i don't think it's the official way.&lt;/P&gt;
&lt;P&gt;Thanks in advance,&lt;/P&gt;
&lt;P&gt;Hugo&lt;/P&gt;
&lt;P&gt;Edit : I want a way to "usurpate" the user account as admin &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I've a website where a user connect via a CAS. When authenticated he can access to a "Nuxeo Interface" (not the nuxeo website but an intern page of my website where he can search for particular documents).
So the user doesn't connect to Nuxeo with his account because i don't want him to enter his password again, i use the CAS username which is the same as the Nuxeo username to get his groups.
At the same time i get all documents from Nuxeo where he makes a demand, i get the ACL of the document with fetch_acls() and compare the groups and permission to user_groups. So I've an array of array of documents with user permission returned by my method :&lt;/P&gt;
&lt;P&gt;Something like this :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;[
[ Document1, Write ],
[ Document2, Read ],
]
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But i've heard that there's a better way to do this, like "usurpate" user by directly taking all documents accessible by him, instead of doing this by myself in my app&lt;/P&gt;
&lt;P&gt;Hope you understand&lt;/P&gt;
&lt;P&gt;Hugo&lt;/P&gt;
&lt;P&gt;The part to get permission :
A "node" is a Document&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;def check_perm_level(old, new):
if old &amp;gt;= new:
return old
else:
return new
def get_node_permission(node, groups):
perm_level = 0
acls = node.fetch_acls()
for i in range(len(acls)):
permissions = acls[i]["aces"]
for permission in permissions:
if permission['username'] not in groups or permission['granted'] == "False":
continue
else:
if permission['permission'] == 'Read':
perm_level = check_perm_level(perm_level, 1)
elif permission['permission'] == 'ReadWrite':
perm_level = check_perm_level(perm_level, 2)
elif permission['permission'] == 'Everything':
perm_level = check_perm_level(perm_level, 3)
return perm_level
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Feb 2021 07:32:47 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/get-all-accesssible-document-of-a-user-while-being-authenticated/m-p/325282#M12283</guid>
      <dc:creator>De_Grossi_Hugo</dc:creator>
      <dc:date>2021-02-15T07:32:47Z</dc:date>
    </item>
    <item>
      <title>Re: Get all accesssible document of a user while being authenticated as Administrator PYTHON API</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/get-all-accesssible-document-of-a-user-while-being-authenticated/m-p/325283#M12284</link>
      <description>&lt;P&gt;Could you share your code please?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 09:11:09 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/get-all-accesssible-document-of-a-user-while-being-authenticated/m-p/325283#M12284</guid>
      <dc:creator>Mickaël_Schoent</dc:creator>
      <dc:date>2021-02-15T09:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: Get all accesssible document of a user while being authenticated as Administrator PYTHON API</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/get-all-accesssible-document-of-a-user-while-being-authenticated/m-p/325284#M12285</link>
      <description>&lt;P&gt;I've answered you in the commentary below, thanks in advance&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 11:53:35 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/get-all-accesssible-document-of-a-user-while-being-authenticated/m-p/325284#M12285</guid>
      <dc:creator>De_Grossi_Hugo</dc:creator>
      <dc:date>2021-02-15T11:53:35Z</dc:date>
    </item>
    <item>
      <title>Re: Get all accesssible document of a user while being authenticated as Administrator PYTHON API</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/get-all-accesssible-document-of-a-user-while-being-authenticated/m-p/325285#M12286</link>
      <description>&lt;P&gt;[Mickaël Schoentgen](https&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 11:54:39 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/get-all-accesssible-document-of-a-user-while-being-authenticated/m-p/325285#M12286</guid>
      <dc:creator>De_Grossi_Hugo</dc:creator>
      <dc:date>2021-02-15T11:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: Get all accesssible document of a user while being authenticated as Administrator PYTHON API</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/get-all-accesssible-document-of-a-user-while-being-authenticated/m-p/325286#M12287</link>
      <description>&lt;P&gt;Did you see [Auth.LoginAs](https&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2021 13:45:02 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/get-all-accesssible-document-of-a-user-while-being-authenticated/m-p/325286#M12287</guid>
      <dc:creator>Mickaël_Schoent</dc:creator>
      <dc:date>2021-02-16T13:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: Get all accesssible document of a user while being authenticated as Administrator PYTHON API</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/get-all-accesssible-document-of-a-user-while-being-authenticated/m-p/325287#M12288</link>
      <description>&lt;P&gt;Yes something like that, but i can't figure how to use it&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2021 15:21:05 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/get-all-accesssible-document-of-a-user-while-being-authenticated/m-p/325287#M12288</guid>
      <dc:creator>De_Grossi_Hugo</dc:creator>
      <dc:date>2021-02-16T15:21:05Z</dc:date>
    </item>
  </channel>
</rss>

