Hello everyone,
I want to do basic access management in NAV 2015 via Web Servie ODATA.
The goal ist to create a user (and connect to AD-User) and to assign one or more permissions from predefined roles.
I was able to create the user and set the windows login by publishing and using Page '9807'.
But I am not able to assign a permission to it. I am using Page '9808'.
Here the $metadata of OData Service
<EntityType Name="UserPermissionRights"><Key><PropertyRef Name="Company_Name"/><PropertyRef Name="Role_ID"/><PropertyRef Name="User_Security_ID"/></Key><Property Name="User_Security_ID" Nullable="false" Type="Edm.Guid"/><Property Name="Role_ID" Nullable="false" Type="Edm.String"/><Property Name="Company_Name" Nullable="false" Type="Edm.String"/><Property Name="_x003C_Description_x003E_" Type="Edm.String"/><Property Name="ETag" Type="Edm.String" ConcurrencyMode="Fixed"/></EntityType>
When I do a POST request, I set the "User_Security_ID" and the "Role_ID" BASIS (the standard role) and it creates an entry, but ONLY with the security ID, while the Role_ID ist empty String ''.
The payload JSON:
{"User_Security_ID": "00000000-0000-0000-0000-000000000001","Role_ID": "BASIS" }
Response: Created
<entry xml:base="http://...serviceHost.../" m:etag="W/"'TheETag'"" xmlns="http://www.w3.org/2005/Atom" xmlns:d="schemas.microsoft.com/.../dataservices" xmlns:m="schemas.microsoft.com/.../metadata"><id>http://...serviceHost.../Company('Northwind')/UserPermissionRights(Company_Name='',Role_ID='',User_Security_ID=guid'00000000-0000-0000-0000-000000000001')</id><category term="NAV.UserPermissionRights" scheme="schemas.microsoft.com/.../scheme"/><link rel="edit" title="UserPermissionRights" href="Company('Northwind')/UserPermissionRights(Company_Name='',Role_ID='',User_Security_ID=guid'00000000-0000-0000-0000-000000000001')"/><title/><updated>2017-05-26T14:37:13Z</updated><author><name/></author><content type="application/xml"><m:properties><d:User_Security_ID m:type="Edm.Guid">00000000-0000-0000-0000-000000000001</d:User_Security_ID><d:Role_ID/><d:Company_Name/><d:_x003C_Description_x003E_/><d:ETag>TheETag</d:ETag></m:properties></content></entry>
The entry is created and visible via GET and in NAV Client, but without Role_ID (...or Company_Name obviously). I would be able to fill in the role ID in NAV client directly, but that is not my goal.
The entry can be removed with DELETE and using correct eTag. Also tried PATCH or PUT the entry but the Role_ID does not change, probably because it is a key value...
Thought about association, but the Role_ID is only defined as String in metadata and no association is visible in Metadata
Tried to use Page '9807' (maybe name is 'UserCard?' in EN language). There appeared an association in metadat and I could use a POST request creatiung a permission. But the Role_ID was also not reacting and btw. the permission was only temporary...
I have no further idea how to create a Permission user<>role_ID.
Can anybody help me? Do I need a special page? I would be glad for any information.
Thank you in advance!
Alexander