Skip to content

Commit e19d3dd

Browse files
fix(format): apply gofmt and black formatting fixes
- Run gofmt on Go files to fix formatting issues - Apply black formatter to Python test file - Fix Python linting issues (unused imports, comparison style) - Remove unused local variables in Python tests This resolves CI formatting failures.
1 parent 4b25ca6 commit e19d3dd

File tree

3 files changed

+559
-193
lines changed

3 files changed

+559
-193
lines changed

src/common/security/robot/context.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func (s *SecurityContext) Can(ctx context.Context, action types.Action, resource
121121
s.evaluator = rbac_project.NewEvaluator(s.ctl, rbac_project.NewBuilderForPolicies(s.GetUsername(), accesses, filterRobotPolicies))
122122
}
123123
})
124-
124+
125125
return s.evaluator != nil && s.evaluator.HasPermission(ctx, resource, action)
126126
}
127127

src/server/v2.0/handler/robot.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func (rAPI *robotAPI) CreateRobot(ctx context.Context, params operation.CreateRo
112112
if err != nil {
113113
return rAPI.SendError(ctx, err)
114114
}
115-
115+
116116
// If no creator robots found in the specific project, check for system robots with wildcard permissions
117117
if len(creatorRobots) == 0 && r.Level == robot.LEVELPROJECT {
118118
systemCreatorRobots, err := rAPI.robotCtl.List(ctx, q.New(q.KeyWords{
@@ -124,7 +124,7 @@ func (rAPI *robotAPI) CreateRobot(ctx context.Context, params operation.CreateRo
124124
if err != nil {
125125
return rAPI.SendError(ctx, err)
126126
}
127-
127+
128128
// Check if any system robot has wildcard project permissions for robot creation
129129
for _, sysRobot := range systemCreatorRobots {
130130
if rAPI.hasWildcardRobotPermission(sysRobot, rbac.ActionCreate) {
@@ -133,7 +133,7 @@ func (rAPI *robotAPI) CreateRobot(ctx context.Context, params operation.CreateRo
133133
}
134134
}
135135
}
136-
136+
137137
if len(creatorRobots) == 0 {
138138
return rAPI.SendError(ctx, errors.DeniedError(nil))
139139
}
@@ -338,14 +338,14 @@ func (rAPI *robotAPI) RefreshSec(ctx context.Context, params operation.RefreshSe
338338

339339
func (rAPI *robotAPI) requireAccess(ctx context.Context, r *robot.Robot, action rbac.Action) error {
340340
sc, _ := rAPI.GetSecurityContext(ctx)
341-
341+
342342
// Special case: system robots with wildcard project permissions
343343
if robotSc, ok := sc.(*robotSc.SecurityContext); ok && robotSc.User().Level == robot.LEVELSYSTEM {
344344
if r.Level == robot.LEVELPROJECT && rAPI.hasWildcardRobotPermission(robotSc.User(), action) {
345345
return nil // Allow system robots with wildcard permissions
346346
}
347347
}
348-
348+
349349
if r.Level == robot.LEVELSYSTEM {
350350
return rAPI.RequireSystemAccess(ctx, action, rbac.ResourceRobot)
351351
} else if r.Level == robot.LEVELPROJECT {

0 commit comments

Comments
 (0)