Developer forum

Forum » Development » Frontend paragraph permissions as opposed to page permissions

Frontend paragraph permissions as opposed to page permissions


Reply
On login I assign the user to extra Groups, by adding the AccessuserID to the "DW_extranet_groups" session.  (PageView.User.Groups)
 
This works fine on Page permissions, but not on paragraph permissions.
 
My investigations show, that the two permissions handlers don’t use the same method for permission validation. The Paragraph permissions validations retrieves the user from the AccessUser database table, while the  page permissions validations gets it from the PageView.User.
 
Is there a reason for this? I would prefer getting the user from PageView.User in both cases.

DW version: 19.1.2.7

Replies

 
Nicolai Høeg Pedersen
Reply
Paragraph permissions is a feature introduced after the new user management. User management has a different store for permissions. Because of backwards compatibility on group permissions on page your old code still works after upgrading to user management - or if not using user management at all.
 
Reply
We often need to add users to groups dynamically based on information from other systems.

Sometimes a user only exists in the current session - not stored in AccessUser - like when we let users log in with NemID or similar SSO services.

It is a huge problem for us if DW requires that the user and all group relations are stored in the AccessUser table in order to get permissions to work as intended.

Is there a workaround for this?

/Morten
 
Nicolai Høeg Pedersen
Reply
I'll have someone look at a possible workaround with example.
 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply
It's not currently possible to dynamically set permissions for paragraphs. The reason for this is, that you don't have access to the ParagraphClass object at the time of render, and the permissions are set on this object. Unfortunately the notification Dynamicweb.Notifications.Standard.Paragraph.OnBeforeRender is invoked after permissions are applied.

However I have added this request to our BackLog.

- Jeppe
 
Reply
Hi Jeppe,
 
The issues is not adding permissions to the paragraph dynamically. The permission is added to the paragraph in DW backend. The issue is adding Usermanagement groups to the user dynamically.
 
Reply
Is there any news regarding a workaround or fix for this issue?

/Christian
 
Nicolai Høeg Pedersen
Reply
No - still in the backlog.
 
Christian Fisker
Reply

Well, the issue popped up again an this time there IS a solution (at least for DW8) and there might be information about this elsewhere.. I have not looked for it.

 

How to dynamically/programatically add a user to a usergroup after login:

 

Dynamicweb.Modules.UserManagement.User.GetCurrentUser().AddToGroup(21492);

 

/Christian

 

 
Nicolai Høeg Pedersen
Reply

Hi Christian

 

Thanks for sharing!

 

BR Nicolai

 

You must be logged in to post in the forum