lahirujayathilake commented on code in PR #524:
URL: https://github.com/apache/airavata-custos/pull/524#discussion_r3576984738


##########
web/src/app/(portal)/admin/users/roles/PermissionMatrixEditor.tsx:
##########
@@ -17,38 +17,70 @@
 
 "use client";
 
-import { PermissionRW } from "@/shared/users-admin/PermissionRW";
+import { cn } from "@/lib/utils";
 import type { PermissionKey } from "@/shared/users-admin/permissions";
-import { rwStateFor } from "@/shared/users-admin/permissions";
+import { DEFAULT_PERMISSION_KEYS, permissionRowsFor } from 
"@/shared/users-admin/permissions";
+
+const ACTION_CHIP_CLASSES: Record<string, string> = {
+  read: "bg-[color:var(--tone-info-bg)] text-[color:var(--tone-info-fg)]",
+  write: "bg-[color:var(--tone-ok-bg)] text-[color:var(--tone-ok-fg)]",
+};
+const ACTION_CHIP_FALLBACK =
+  "bg-[color:var(--tone-accent-bg)] text-[color:var(--tone-accent-fg)]";
+const INACTIVE_CHIP_CLASS = "bg-muted text-muted-foreground";

Review Comment:
   `bg-muted` is the same color as the card background in dark mode



##########
web/src/app/(portal)/admin/users/roles/RoleCard.tsx:
##########
@@ -45,30 +43,19 @@ export function RoleCard({ role, memberCount }: { role: 
RoleRow; memberCount: nu
             <p className="mt-1 text-sm 
text-muted-foreground">{role.description}</p>
           </div>
           <Badge variant="secondary" className="shrink-0">
-            {memberCount} {memberCount === 1 ? "member" : "members"}
+            {role.memberCount} {role.memberCount === 1 ? "member" : "members"}
           </Badge>
         </div>
       </CardHeader>
       <CardContent className="space-y-4">
         <div className="border-t border-border" />
 
-        <div>
-          <h4 className="mb-2 text-xs font-semibold uppercase tracking-wide 
text-muted-foreground">
-            Effective Privileges
-          </h4>
-          {rwPermissions.length === 0 ? (
-            <p className="text-sm text-muted-foreground">No privileges 
granted.</p>
-          ) : (
-            <ul className="space-y-2">
-              {rwPermissions.map((p) => (
-                <li key={p.section} className="flex items-center 
justify-between text-sm">
-                  <span className="font-mono 
text-foreground">{p.section}</span>
-                  <PermissionRW read={p.read} write={p.write} />
-                </li>
-              ))}
-            </ul>
-          )}
-        </div>
+        <PermissionMatrixEditor
+          permissions={role.privileges}
+          catalog={catalog}
+          onTogglePermission={() => undefined}
+          editable={false}
+        />

Review Comment:
   This card should only list the privileges the role grants not the entire 
catalog



##########
web/src/shared/users-admin/permissions.ts:
##########
@@ -15,38 +15,85 @@
 // specific language governing permissions and limitations
 // under the License.
 
-// Permission sections mirror the backend's privilege scopes (domain:resource,
-// e.g. "core:allocations"), so each section can be granted read/write
-// independently. Displayed verbatim as the effective-privilege key.
-export const PERMISSION_SECTIONS = [
-  "amie:packets",
-  "amie:replies",
-  "amie:unmapped",
-  "core:allocations",
-  "core:clusters",
-  "core:organizations",
-  "core:projects",
-  "core:traces",
-  "core:users",
-  "temp-account:accounts",
+export const DEFAULT_PERMISSION_KEYS = [

Review Comment:
   better to remove the hardcoded list instead of keeping it as a fallback. 
Make  GET /privileges/catalog is the only source 



##########
web/src/shared/layout/UserPill.tsx:
##########
@@ -81,7 +81,7 @@ export function UserPill() {
             onClick={() => void signOut()}
           >
             <LogOut className="mr-2 h-4 w-4" />
-            {isPending ? "Signing out…" : "Sign out"}
+            Sign out

Review Comment:
   please revert this change, this was added on purpose



##########
web/src/shared/layout/nav.ts:
##########
@@ -21,8 +21,8 @@ import {
   ClipboardList,
   FolderKanban,
   HardDrive,
-  type LucideIcon,
   Server,
+  type LucideIcon,

Review Comment:
   revert this change



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to