Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add custom attribute for Netgroups? #91

Open
fyrie6870 opened this issue Jun 3, 2022 · 1 comment
Open

How to add custom attribute for Netgroups? #91

fyrie6870 opened this issue Jun 3, 2022 · 1 comment

Comments

@fyrie6870
Copy link

I found instructions here to create custom attributes, add it to schema, and write a plugin. So I tried adding two custom attributes for netgroups: groupid and authlevel. However, when I try using the ipa netgroup-add test --addattr=groupid=1 it does not allow me. So I thought creating permissions would work but, the attributes do not show up on the Netgroup type but instead show up in User Group type.

Here is the schema I'm trying to add. I can confirm they get added.

dn: cn=schema
changetype: modify
add: attributeTypes
attributeTypes: ( 2.25.XXX.XX.X.X NAME 'authlevel' DESC 'Attribute to store the authentication level of a group' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Extending FreeIPA' )

dn: cn=schema
changetype: modify
add: attributeTypes
attributeTypes: ( 2.25.XXXX.XX.X.X NAME 'groupid' DESC 'Attribute to store the ID of a group' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Extending FreeIPA' )

dn: cn=schema
changetype: modify
add: objectclasses
objectclasses: ( 2.25.XXXX.XX.X.X NAME 'netGroup' DESC 'objectClass for authlevel, and groupid' SUP ipaNISNetgroup STRUCTURAL MAY ( groupid $ authlevel ) X-ORIGIN 'Extending FreeIPA' )
ipa config-mod --addattr=ipaGroupObjectClasses=netGroup

Here is one of the plugin file that I wrote, not sure if it is correct:

from ipaserver.plugins import netgroup
from ipalib.parameters import Int
from ipalib import _

netgroup.netgroup.takes_params = netgroup.netgroup.takes_params + (
    Int("authlevel?", cli_name="authlevel", label=_("Authentication Level"), doc=_("Store the authentication level of a group (default is 2)."),),
)

netgroup.netgroup.default_attributes.append("authlevel")
@abbra
Copy link
Owner

abbra commented Jun 3, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants