Developer forum

Forum » Development » user.Item is missing in 9.4.x (tested: 9.4.12)

user.Item is missing in 9.4.x (tested: 9.4.12)

Allan Iversen
Allan Iversen
Reply

Hi,

Where do I find the Item property on Dynamicweb.Security.UserManagement.User?

Allan


Replies

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply
This post has been marked as an answer

Hi Allan,

I'm not sure why it was removed, but you can get the item like this:

var user = Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUser();
if (!string.IsNullOrEmpty(user.ItemType) && !string.IsNullOrEmpty(user.ItemId))
{
    var userItem = Dynamicweb.Services.Items.GetItem(user.ItemType, user.ItemId);
    if (userItem != null)
    {
        // do your thing
    }
}

Best regards,
Morten

Votes for this answer: 1
 
Allan Iversen
Allan Iversen
Reply

Hi Morten,

Thanks - I will do this for now.

BR,

Allan

 
Martin Vang
Martin Vang
Reply

Hi Allan,

Items where not meant to be part of the User-object. They have custom fields, so the whole logic connecting Users and Items has been removed.

@NP: Was this by mistake?

BR

Martin

 
Nicolai Pedersen
Reply

No, it was because security is further down the DW9 architecture stack and does not have access to items which is in Dynamicweb.dll. So it is a technical issue.

But items should never have been on a user.... But that is another topic.

 

You must be logged in to post in the forum