Sorting rights in SelectRights

Dunno if anyone else gets tired of looking at the default ordering of
assigned rights in Admin/Queues/UserRights.html et. al., but I did.

Comments welcome.

diff ./rt2/WebRT/html/Admin/Elements/SelectRights*

17,18c17,19
< % foreach $right (sort keys %RightIds) {
<
<%$right%>

% while (my $right = $ACLObj->Next()) {
% if ($right->RightName) {

<%$right->RightName%>

19a21
% }
24c26
< my ($right, $ACLDesc, $AppliesTo, %Rights, %RightIds);
my ($right, $ACLDesc, $AppliesTo, %Rights);
49,54d50
<
< while (my $right = $ACLObj->Next()) {
< if ($right->RightName) {
< $RightIds{$right->RightName}=$right->Id;
< }
< }

Having gotten no comments, I’m wondering if this would be welcomed as a
patch.----- Original Message -----
From: “Peter E. Popovich” peter@popovich.net
To: rt-devel@lists.fsck.com
Sent: Monday, January 07, 2002 6:25 PM
Subject: [rt-devel] Sorting rights in SelectRights

Dunno if anyone else gets tired of looking at the default ordering of
assigned rights in Admin/Queues/UserRights.html et. al., but I did.

Comments welcome.

diff ./rt2/WebRT/html/Admin/Elements/SelectRights*

17,18c17,19
< % foreach $right (sort keys %RightIds) {
<
<%$right%>

% while (my $right = $ACLObj->Next()) {
% if ($right->RightName) {

<%$right->RightName%>

19a21
% }
24c26
< my ($right, $ACLDesc, $AppliesTo, %Rights, %RightIds);


my ($right, $ACLDesc, $AppliesTo, %Rights);

49,54d50
<
< while (my $right = $ACLObj->Next()) {
< if ($right->RightName) {
< $RightIds{$right->RightName}=$right->Id;
< }
< }


rt-devel mailing list
rt-devel@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-devel

Haven’t really had time to look at it. Sorry :/On Thu, Jan 10, 2002 at 11:37:45AM -0800, Peter E. Popovich wrote:

Having gotten no comments, I’m wondering if this would be welcomed as a
patch.

----- Original Message -----
From: “Peter E. Popovich” peter@popovich.net
To: rt-devel@lists.fsck.com
Sent: Monday, January 07, 2002 6:25 PM
Subject: [rt-devel] Sorting rights in SelectRights

Dunno if anyone else gets tired of looking at the default ordering of
assigned rights in Admin/Queues/UserRights.html et. al., but I did.

Comments welcome.

diff ./rt2/WebRT/html/Admin/Elements/SelectRights*

17,18c17,19
< % foreach $right (sort keys %RightIds) {
<
<%$right%>

% while (my $right = $ACLObj->Next()) {
% if ($right->RightName) {

<%$right->RightName%>

19a21
% }
24c26
< my ($right, $ACLDesc, $AppliesTo, %Rights, %RightIds);


my ($right, $ACLDesc, $AppliesTo, %Rights);

49,54d50
<
< while (my $right = $ACLObj->Next()) {
< if ($right->RightName) {
< $RightIds{$right->RightName}=$right->Id;
< }
< }


rt-devel mailing list
rt-devel@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-devel


rt-devel mailing list
rt-devel@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-devel

http://www.bestpractical.com/products/rt – Trouble Ticketing. Free.

Having gotten no comments, I’m wondering if this would be welcomed as a
patch.

Haven’t really had time to look at it. Sorry :confused:

S’cool. I just wasn’t sure if there was something about the code I’d
proposed that made it undesireable on its face. “Whenever you can get around
to it” will be plenty soon enough.

The purpose of the change is to sort the rights assigned to users and
groups, rather than leaving them sorted by the ordering in which ACLObj
returns them.

In the init section, I added a hash, %RightIds, populated with each
$right->Id using $right-RightName as its key. In the page display section,
instead of iterating ACLObj->Next(), I simply iterate on (sort keys
%RightIds).

The diffs in context form:

*** ./rt2/WebRT/html/Admin/Elements/SelectRights.orig Mon Jan 7 17:12:01
2002
— ./rt2/WebRT/html/Admin/Elements/SelectRights Thu Jan 10 15:04:41
2002
*** 14,29 ****

Current rights

(Check box to revoke right)
! % while (my $right = $ACLObj->Next()) { ! % if ($right->RightName) { ! <%$right->RightName%>
% } - % } <%INIT> ! my ($right, $ACLDesc, $AppliesTo, %Rights);
  my $ACLObj = new RT::ACL($session{'CurrentUser'});

— 14,27 ----

Current rights

(Check box to revoke right)
! % foreach $right (sort keys %RightIds) { ! <%$right%>
% } <%INIT> ! my ($right, $ACLDesc, $AppliesTo, %Rights, %RightIds);
  my $ACLObj = new RT::ACL($session{'CurrentUser'});

*** 48,53 ****
— 46,57 ----
}

  $ACLDesc = "$PrincipalType-".$PrincipalObj->Id."-$Scope-$AppliesTo";
  • while (my $right = $ACLObj->Next()) {
    
  •   if ($right->RightName) {
    
  •     $RightIds{$right->RightName}=$right->Id;
    
  •   }
    
  • }
    

    </%INIT>

    <%ARGS>