tanishqgandhi1908 commented on code in PR #8890:
URL: https://github.com/apache/texera/pull/8890#discussion_r4343398423


##########
common/resource/src/main/scala/org/apache/texera/service/resource/ResourceAccess.scala:
##########
@@ -69,32 +69,34 @@ object ResourceAccess {
     ).flatMap(record => Option(record.value1()))
       .contains(uid)
 
+  /** The owner always has WRITE, whatever their own access row says. */
   def privilegeOf[R <: Record, A <: Record](
       ctx: DSLContext,
       resource: ResourceTables[R, A],
       id: Integer,
       uid: Integer
   ): PrivilegeEnum =
-    Option(
-      ctx
-        .select(resource.privilegeField)
-        .from(resource.accessTable)
-        .where(
-          resource.accessIdField
-            .eq(id)
-            .and(resource.accessUidField.eq(uid))
-        )
-        .fetchOneInto(classOf[PrivilegeEnum])
-    ).getOrElse(PrivilegeEnum.NONE)
+    if (userOwns(ctx, resource, id, uid)) PrivilegeEnum.WRITE
+    else

Review Comment:
   Added OwnerAccess.privilege(isOwner, granted), now used by ResourceAccess, 
unified search and ComputingUnitAccess.



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