Read Custom Attribute on Security Group

General discussion of using Adaxes for Active Directory management and administration
Post Reply
mark.munson
Posts: 5
Joined: Tue Dec 04, 2018 2:56 pm

Read Custom Attribute on Security Group

Thu Dec 06, 2018 9:26 am

I can get the name ("cn") of the group but I am getting null for hubId ("adm-CustomAttributeText1"). What am I doing wrong here?

var parentContainer = (IADsContainer)admService.OpenObject("Adaxes://OU=All Field Users,OU=01_RCX Users,DC=railcrewxpress,DC=local", null, null, 0);
parentContainer.Filter = new object[] { "organizationalunit" };

foreach (IADs orgUnit in parentContainer)
{
var container = (IADsContainer)admService.OpenObject(orgUnit.ADsPath, null, null, 0);
container.Filter = new object[] { "group" };

foreach (IADs group in container)
{
try
{
var name = group.Get("cn").ToString();
var hubId = group.Get("adm-CustomAttributeText1").ToString();
}
catch
{ }
}
}

Thanks!

User avatar
Support2
Posts: 790
Joined: Mon Nov 14, 2016 4:03 am

Re: Read Custom Attribute on Security Group

Thu Dec 06, 2018 10:50 am

Hello Mark,

The script looks correct. There are two possible reasons why you get null for the CustomAttributeText1 attribute. Either it is actually empty for the groups you are checking or the account of the currently logged on user has no permissions to read the attribute. In Adaxes, permissions are granted by Security Roles. For information on how to check the roles assigned to a user, see https://www.adaxes.com/help/?HowDoI.Man ... forms.html. Take into account that Deny permissions always override the Allow ones.
Active Directory Identity Management

Follow Adaxes in social networks
Image Image Image Image

mark.munson
Posts: 5
Joined: Tue Dec 04, 2018 2:56 pm

Re: Read Custom Attribute on Security Group

Fri Dec 07, 2018 9:49 am

I've assigned a security role for full control over the group in question to my AD account that I am logged into my PC with but I am still having problems.
I can read all of these properties except the last two that are custom attributes. Is there a special permission I need to use or a property specific permission that is required to read these custom attributes?

var groupName = group.Get("cn").ToString();
var name = group.Get("name").ToString();
var distinguishedName = group.Get("distinguishedName").ToString();
var description = group.Get("description").ToString();
var created = group.Get("whenCreated").ToString();
var changed = group.Get("whenChanged").ToString();
var hubIdText = group.Get("adm-CustomAttributeText1").ToString();
var hubIdInt = group.Get("adm-CustomAttributeInt1").ToString();


Thanks for your help.

User avatar
Support2
Posts: 790
Joined: Mon Nov 14, 2016 4:03 am

Re: Read Custom Attribute on Security Group

Fri Dec 07, 2018 10:23 am

Hello,

There are no special permissions required, the Full Control permission applied to Group objects covers the custom attributes too. However, there might be another Security Role assigned to the user that denies the permission to read the properties. Deny permissions always override the Allow ones. For information on how to check Security Roles assigned to a user, see https://www.adaxes.com/help/?HowDoI.Man ... forms.html.

Also, did you make sure that the custom attributes CustomAttributeText1 and CustomAttributeInt1 are set for the group(s) you are querying? Could you check that via Adaxes Administration Console? Just select a group in the Console Tree and check whether the attributes are displayed in the Result Pane on the right.
Group.property.values.png
Group.property.values.png (5.58 KiB) Viewed 110 times
Active Directory Identity Management

Follow Adaxes in social networks
Image Image Image Image

mark.munson
Posts: 5
Joined: Tue Dec 04, 2018 2:56 pm

Re: Read Custom Attribute on Security Group

Fri Dec 07, 2018 11:43 am

Here are the security roles for the user (Read Properties role gives Full Control): There are no Deny permissions on any of the built in's.
UserSecurityRoles.PNG
UserSecurityRoles.PNG (3.98 KiB) Viewed 106 times
And here are the attributes for the group:
GroupAttributes.PNG
GroupAttributes.PNG (34.36 KiB) Viewed 106 times

User avatar
Support
Site Admin
Posts: 2315
Joined: Thu Apr 23, 2009 2:28 am

Re: Read Custom Attribute on Security Group

Mon Dec 10, 2018 9:21 am

Hello Mark,

Could you post here or send us (support[at]adaxes.com) the screenshots of all Security Roles assigned to the user with Assignments? We need something like the following for each Security Role:
Security.role.png
Security.role.png (15.5 KiB) Viewed 36 times
Active Directory Identity Management

Follow Adaxes in social networks
Image Image Image Image

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest