File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ func NewCELAuthorizer(reader client.Reader, prefix string) (authorizer.Authorize
4040			celgo .Variable ("self" , celgo .DynType ),
4141			celgo .Variable ("user" , celgo .DynType ),
4242			celgo .Variable ("prefix" , celgo .StringType ),
43+ 			celgo .Variable ("kind" , celgo .StringType ),
4344		},
4445	})
4546	if  err  !=  nil  {
@@ -92,7 +93,7 @@ func (b *CELAuthorizer) Authorize(
9293	}
9394
9495	compiled , err  :=  b .compiler .CompileCELExpression (& Expression {
95- 		Expression : "(has(self.spec.username) ? self.spec.username : prefix + self. kind.lowerAscii() + ':' + self.metadata.namespace + ':' + self.metadata.name + ':' + self.metadata.uid) == user.username" ,
96+ 		Expression : "(has(self.spec.username) ? self.spec.username : prefix + kind.lowerAscii() + ':' + self.metadata.namespace + ':' + self.metadata.name + ':' + self.metadata.uid) == user.username" ,
9697	})
9798
9899	user  :=  attributes .GetUser ()
@@ -105,6 +106,7 @@ func (b *CELAuthorizer) Authorize(
105106			"extra" :    user .GetExtra (),
106107		},
107108		"prefix" : b .prefix ,
109+ 		"kind" :   attributes .GetResource (),
108110	})
109111	if  err  !=  nil  {
110112		return  authorizer .DecisionDeny , "failed to evaluate expression" , err 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments