[rt-users] Documenting RT Queue configs?

Howard Jones howie at thingy.com
Thu May 12 07:02:56 EDT 2011


On 09/05/2011 10:30, Howard Jones wrote:
> I'd like to be able to present that information with the context of the
> groups people are members of, so it's obvious that a whole block of
> people are affected by the same group membership (I try to avoid giving
> single users special permissions):
>
> ModifyTicket:
>     User1
>     User2
>     Group1:
>         Group2:
>             User3
>             User4
>         User5
>
> Before I dig into GroupMembers and figure it out, does such a thing
> already exist? It seems like it'd be quite useful... RightsMatrix does
> it from the point of view of a User, but not a Queue.
>
Just to stop this being one of those never-answered search hits, here's
the function I came up with to do the recursive group part of this.
Given an RT::Group, it produces a nested <ul> list of all the groups,
and their members. Each group and user has a link to their page in the
Admin webui, so you can use it to tweak things.

The actual rights checking I stole straight out of
Admin/Queues/GroupRights.html and Admin/Elements/SelectRights.

 print "<ul>";
 print explode_group($Queue->AdminCc());
 print "</ul>";



sub explode_group {
    my ($Group) = @_;

        my $results = "";

    my $members = $Group->MembersObj();
    while ( my $member = $members->Next ) {
        $results .= "<li><strong>" . $member->MemberObj->Object->Name .
"</strong>";
        if ( $member->MemberObj->IsGroup ) {
            $results .= " <a href='"
              . $RT::WebURL
              . "/Admin/Groups/Modify.html?id="
              . $member->MemberObj->Object->id
              . "'>[C]</a>";
            $results .= "<ul>";
            $results .= explode_group( $member->MemberObj->Object );
            $results .= "</ul>";
        }
        else {
            $results .=  " <a href='"
              . $RT::WebURL
              . "/Admin/Users/Modify.html?id="
              . $member->MemberObj->Object->id
              . "'>[C]</a>";
            $results .= " <em>"
              . ( $member->MemberObj->Object->RealName || "" ) . "</em>";
            $results .= " - ";
            $results .= $member->MemberObj->Object->EmailAddress;
            if ( $member->MemberObj->Object->Disabled ) {
                $results .= " <strong class='warning'>DISABLED</strong>";
            }
        }

        $results .=  "</li>";
    }

        return $results;

}




More information about the rt-users mailing list