Hi Erik,
had a quick look at this, and "works for me"... in snapshot at least.  But
I don't think there's be any recent fix in this space.

In the todo/quickstart app, I added the following to Admin service class:


*    public static final Function<RoleMemento, Object> ROLE_NAME = new
Function<RoleMemento, Object>() {*
*        @Override*
*        public Object apply(RoleMemento input) {*
*            return input.getName();*
*        }*
*    };*

*    @ActionSemantics(Of.SAFE)*
*    public String listRoles() {*
*        final List<RoleMemento> roles =
getContainer().getUser().getRoles();*
*        return "Roles: " + Joiner.on(",").join(Iterables.transform(roles,
ROLE_NAME));*
*    }*


when I invoke that action, I get:


*    Roles: realm1:admin_role,org.apache.isis.viewer.wicket.roles.USER *


Which looks correct to me; "realm1:admin_role" is the one from the
realm1.ini (Shiro file), and the other is Isis' internal role for managing
access to pages.


Dan



On 27 May 2014 12:53, Dan Haywood <[email protected]> wrote:

>
>
>
> On 27 May 2014 12:40, Erik de Hair <[email protected]> wrote:
>
>> What do you mean with "Is that the Shiro API?"
>>
>>
> Shiro (which Isis integrates with / sits on top of) has its own API; was
> wondering if you were using it.
>
> If you do SubjectUtils.getUser() (or it might be SubjectUtil), then you
> can get hold of Shiro's representation of the user.
>
>
>
>
>> I tried it the way you described but that only gives me the wicket role
>> mentioned before.
>>
>>
> OK, in which case I need to look into that.
>
> Even if Shiro (per above) does provide access to the roles etc, even so
> Isis ought to be able to provide that info through its API (ie it shouldn't
> be necessary to dig down to Shiro).  Which it patently isn't.  Slightly
> confused as to why not.
>
> Will take a look-see this eve.
>
> Dan
>
>
>
>
>>
>>
>> On 05/27/2014 12:40 PM, Dan Haywood wrote:
>>
>> Is that the Shiro API?
>>
>> ~~~
>> I think (hope) that you can get the actual roles via Isis' API:
>>
>> UserMemento user = DomainObjectContainer.getUser();
>> List<RoleMemento> roles = user.getRoles()
>>
>> Perhaps we're missing something here, though..?
>>
>> Dan
>>
>>
>>
>> On 27 May 2014 11:35, Erik de Hair <[email protected]><mailto:[email protected]>
>> wrote:
>>
>>
>>
>> Hi,
>>
>> Calling getUser().getRoles() only gives the role
>> "org.apache.isis.viewer.wicket.roles.USER". Is it possible to get the
>> roles
>> assigned by shiro via JDBC-realm or do I have to query for these roles
>> myself?
>>
>> Thanks,
>> Erik
>>
>>
>>
>>
>>
>>
>>
>

Reply via email to