bito-code-review[bot] commented on code in PR #32995:
URL: https://github.com/apache/superset/pull/32995#discussion_r3501976281


##########
superset-frontend/src/pages/ChartList/index.tsx:
##########
@@ -501,6 +500,11 @@ function ChartList(props: ChartListProps) {
       },
       {
         Cell: ({ row: { original } }: any) => {
+          // Verify owner or isAdmin
+          const allowEdit: boolean =
+            original.owners.map((o: Owner) => o.id).includes(user.userId) ||

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Missing defensive null check</b></div>
   <div id="fix">
   
   Accessing `original.owners.map()` without verifying `owners` exists could 
throw a runtime error when rendering rows where the `owners` field is absent. 
Compare line 478 which safely destructures with `owners = []` default.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #bcab07</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



##########
superset-frontend/src/pages/DashboardList/index.tsx:
##########
@@ -454,6 +455,11 @@ function DashboardList(props: DashboardListProps) {
       },
       {
         Cell: ({ row: { original } }: any) => {
+          // Verify owner or isAdmin
+          const allowEdit: boolean =
+            original.owners.map((o: Owner) => o.id).includes(user.userId) ||
+            isUserAdmin(user);

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Inconsistent permission check logic</b></div>
   <div id="fix">
   
   The new `allowEdit` check only verifies owner or admin status but skips 
`can_write` permission validation. The existing `canUserEditDashboard()` in 
`permissionUtils.ts` (line 49-55) correctly combines owner/admin checks with 
`findPermission('can_write', 'Dashboard', user?.roles)`. A user with 
`can_write` permission would be incorrectly denied edit access if they are 
neither an owner nor an admin. Align this check with `canUserEditDashboard` for 
consistency.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #bcab07</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to