Skip to content

Commit

Permalink
chore: slice loop replace (1Panel-dev#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
testwill authored Sep 3, 2023
1 parent a47dab5 commit e38ff91
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
4 changes: 1 addition & 3 deletions internal/api/v1/session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,7 @@ func (h *Handler) aggregateResourcePermissions(name string) (map[string][]string
var policyRoles []v1Role.PolicyRule
//merge permissions
for i := range rs {
for j := range rs[i].Rules {
policyRoles = append(policyRoles, rs[i].Rules[j])
}
policyRoles = append(policyRoles, rs[i].Rules...)
}
for i := range policyRoles {
for j := range policyRoles[i].Resource {
Expand Down
4 changes: 1 addition & 3 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ func ReadConfig(c *config.Config, path ...string) error {
v.SetConfigName("app")
v.SetConfigType("yaml")

for i := range path {
configFilePaths = append(configFilePaths, path[i])
}
configFilePaths = append(configFilePaths, path...)
for i := range configFilePaths {
realDir := file.ReplaceHomeDir(configFilePaths[i])

Expand Down
4 changes: 1 addition & 3 deletions pkg/certificate/x509.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ func CreateClientCertificateRequest(userName string, key []byte, org ...string)
subj := pkix.Name{
CommonName: userName,
}
for i := range org {
subj.Organization = append(subj.Organization, org[i])
}
subj.Organization = append(subj.Organization, org...)
rawSubj := subj.ToRDNSequence()
asn1Subj, err := asn1.Marshal(rawSubj)
if err != nil {
Expand Down

0 comments on commit e38ff91

Please sign in to comment.