You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by "jorgeeflorez ." <jo...@gmail.com> on 2020/05/07 17:50:37 UTC
Edit group
Hi all,
I was wondering, is it possible to change the name of a group?
I am not sure about it and I want to confirm it, please.
Thanks.
Best Regards.
Jorge
Re: Edit group
Posted by Angela Schreiber <an...@adobe.com.INVALID>.
Hi Jorge
I am glad that you found the answer, which is pretty much exactly what I would have written in reply to your original question had I seen it. Please apologize that it was totally missed.
Maybe I can also point you to the oak-exercise module, which contains additional training material wrt Oak security. It's not complete and doesn't cover every single feature but the basics are there and may provide additional insight.
Kind regards
Angela
________________________________
From: jorgeeflorez . <jo...@gmail.com>
Sent: Wednesday, May 13, 2020 9:00 PM
To: oak-dev@jackrabbit.apache.org <oa...@jackrabbit.apache.org>
Subject: Re: Edit group
Hi,
to answer my own question (and "for the record"). The user id or group id
cannot be changed once it is created (see
https://jackrabbit.apache.org/oak/docs/security/user/default.html ).
However, it is possible to set a value for a property with the name you
want to the Authorizable (user or group) and use that property as you see
fit. For example:
UserManager um = session.getUserManager();
Group myGroup = um.createGroup("myAwesomeGroup");
myGroup.setProperty("color" new StringValue("yellow"));
To get the value after you retrieved an authorizable you can use:
UserManager um = session.getUserManager();
Authorizable authorizable = um.getAuthorizable(group.getId());
Value[] propertyValues = authorizable.getProperty("color");
String color = null;
if (propertyValues != null) {
color = propertyValues[0].getString();
}
Jorge
El jue., 7 may. 2020 a las 12:50, jorgeeflorez . (<
jorgeeduardoflorez@gmail.com>) escribió:
> Hi all,
> I was wondering, is it possible to change the name of a group?
> I am not sure about it and I want to confirm it, please.
>
> Thanks.
>
> Best Regards.
>
> Jorge
>
Re: Edit group
Posted by "jorgeeflorez ." <jo...@gmail.com>.
Hi,
to answer my own question (and "for the record"). The user id or group id
cannot be changed once it is created (see
https://jackrabbit.apache.org/oak/docs/security/user/default.html ).
However, it is possible to set a value for a property with the name you
want to the Authorizable (user or group) and use that property as you see
fit. For example:
UserManager um = session.getUserManager();
Group myGroup = um.createGroup("myAwesomeGroup");
myGroup.setProperty("color" new StringValue("yellow"));
To get the value after you retrieved an authorizable you can use:
UserManager um = session.getUserManager();
Authorizable authorizable = um.getAuthorizable(group.getId());
Value[] propertyValues = authorizable.getProperty("color");
String color = null;
if (propertyValues != null) {
color = propertyValues[0].getString();
}
Jorge
El jue., 7 may. 2020 a las 12:50, jorgeeflorez . (<
jorgeeduardoflorez@gmail.com>) escribió:
> Hi all,
> I was wondering, is it possible to change the name of a group?
> I am not sure about it and I want to confirm it, please.
>
> Thanks.
>
> Best Regards.
>
> Jorge
>