Use proper ctx in list user grants
[ZITADOPER-1]
This commit is contained in:
@@ -321,6 +321,7 @@ func (wr *wrappedMachineUserReconciler) reconcileUserGrants(ctx context.Context,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
ctx = middleware.SetOrgID(ctx, org.Status.OrgId)
|
||||||
existingUserGrants, err := ztdClient.ListUserGrants(ctx, &pb.ListUserGrantRequest{
|
existingUserGrants, err := ztdClient.ListUserGrants(ctx, &pb.ListUserGrantRequest{
|
||||||
Queries: []*user.UserGrantQuery{
|
Queries: []*user.UserGrantQuery{
|
||||||
{
|
{
|
||||||
@@ -335,7 +336,6 @@ func (wr *wrappedMachineUserReconciler) reconcileUserGrants(ctx context.Context,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error listing MachineUser grants: %v", err)
|
return fmt.Errorf("Error listing MachineUser grants: %v", err)
|
||||||
}
|
}
|
||||||
ctx = middleware.SetOrgID(ctx, org.Status.OrgId)
|
|
||||||
for _, userGrant := range wr.MachineUser.DeepCopy().Spec.UserGrants {
|
for _, userGrant := range wr.MachineUser.DeepCopy().Spec.UserGrants {
|
||||||
userGrantedProject, err := wr.refResolver.ProjectRef(ctx, &userGrant.ProjectRef, wr.MachineUser.Namespace)
|
userGrantedProject, err := wr.refResolver.ProjectRef(ctx, &userGrant.ProjectRef, wr.MachineUser.Namespace)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -373,7 +373,7 @@ func (wr *wrappedMachineUserReconciler) reconcileUserGrants(ctx context.Context,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if existingProjectGrant == nil {
|
if existingProjectGrant == nil {
|
||||||
return fmt.Errorf("Error no project granted to user organization: %v", err)
|
return fmt.Errorf("Error no project granted to user organization")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = wr.PatchStatus(ctx, condition.SetPatOutOfDate); err != nil {
|
if err = wr.PatchStatus(ctx, condition.SetPatOutOfDate); err != nil {
|
||||||
@@ -389,7 +389,6 @@ func (wr *wrappedMachineUserReconciler) reconcileUserGrants(ctx context.Context,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error Adding MachineUser grant: %v", err)
|
return fmt.Errorf("Error Adding MachineUser grant: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
sort.Strings(existingUserGrant.RoleKeys)
|
sort.Strings(existingUserGrant.RoleKeys)
|
||||||
sort.Strings(userGrant.RoleKeys)
|
sort.Strings(userGrant.RoleKeys)
|
||||||
|
|||||||
Reference in New Issue
Block a user