[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-3466) @UserRoles only works when using one ManyToMany-Relation instead of two OneToMany-Relations

Michael Wohlfart (JIRA) jira-events at lists.jboss.org
Sat Feb 14 14:26:44 EST 2009


    [ https://jira.jboss.org/jira/browse/JBSEAM-3466?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12452684#action_12452684 ] 

Michael Wohlfart commented on JBSEAM-3466:
------------------------------------------

I am afraid the getImpliedRoles method needs some more magic like so:

    public List<String> getImpliedRoles(String name) {
        Object user = lookupUser(name);
        if (user == null) {
            throw new NoSuchUserException("No such user '" + name + "'");
        }

        Set<String> roles = new HashSet<String>();
        Collection userRoles = (Collection) userRolesProperty.getValue(user);
        if (userRoles != null) {
            for (Object role : userRoles) {
                if (xrefClass == null) {
                    addRoleAndMemberships((String) roleNameProperty.getValue(role), roles);
                } else {
                    // role is an xref class
                    Object xref = xrefRoleProperty.getValue(role);
                    addRoleAndMemberships((String) roleNameProperty.getValue(xref), roles);
                }
            }
        }
        return new ArrayList<String>(roles);
    }

> @UserRoles only works when using one ManyToMany-Relation instead of two OneToMany-Relations
> -------------------------------------------------------------------------------------------
>
>                 Key: JBSEAM-3466
>                 URL: https://jira.jboss.org/jira/browse/JBSEAM-3466
>             Project: Seam
>          Issue Type: Bug
>          Components: Security
>    Affects Versions: 2.1.0.BETA1
>         Environment: EJB 3.0, JBOSS 4.2, SEAM 2.1, RichFaces (3.2) 
>            Reporter: nimo stephan
>            Assignee: Shane Bryzak
>             Fix For: 2.1.0.GA
>
>
> @UserRoles only works in ManyToMany-Relation.
> If we provide two @OneToMany-relations instead of one @ManyToMany, then @UserRoles does not work!
> The UserRolesProperty returns the UserRoles-Instance instead of the Roles-Instance. 
> However, when having  additional attributes in UserRoles we should better use two @OneToMany-Relations - 
> but then @UserRoles does not work.
> As Shane said:
> "I don't think that we currently support cross reference tables in this manner, although we should. "
> Yes, it would be fine:-)
> thanks.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list