@@ -12,7 +12,7 @@ import (
1212 "code.gitea.io/gitea/modules/util"
1313 "code.gitea.io/gitea/services/auth/source/ldap"
1414
15- "github.com/urfave/cli/v2 "
15+ "github.com/urfave/cli/v3 "
1616)
1717
1818type (
@@ -167,35 +167,35 @@ var (
167167 microcmdAuthAddLdapBindDn = & cli.Command {
168168 Name : "add-ldap" ,
169169 Usage : "Add new LDAP (via Bind DN) authentication source" ,
170- Action : func (c * cli.Context ) error {
171- return newAuthService ().addLdapBindDn (c )
170+ Action : func (ctx context. Context , cmd * cli.Command ) error {
171+ return newAuthService ().addLdapBindDn (ctx , cmd )
172172 },
173173 Flags : ldapBindDnCLIFlags ,
174174 }
175175
176176 microcmdAuthUpdateLdapBindDn = & cli.Command {
177177 Name : "update-ldap" ,
178178 Usage : "Update existing LDAP (via Bind DN) authentication source" ,
179- Action : func (c * cli.Context ) error {
180- return newAuthService ().updateLdapBindDn (c )
179+ Action : func (ctx context. Context , cmd * cli.Command ) error {
180+ return newAuthService ().updateLdapBindDn (ctx , cmd )
181181 },
182182 Flags : append ([]cli.Flag {idFlag }, ldapBindDnCLIFlags ... ),
183183 }
184184
185185 microcmdAuthAddLdapSimpleAuth = & cli.Command {
186186 Name : "add-ldap-simple" ,
187187 Usage : "Add new LDAP (simple auth) authentication source" ,
188- Action : func (c * cli.Context ) error {
189- return newAuthService ().addLdapSimpleAuth (c )
188+ Action : func (ctx context. Context , cmd * cli.Command ) error {
189+ return newAuthService ().addLdapSimpleAuth (ctx , cmd )
190190 },
191191 Flags : ldapSimpleAuthCLIFlags ,
192192 }
193193
194194 microcmdAuthUpdateLdapSimpleAuth = & cli.Command {
195195 Name : "update-ldap-simple" ,
196196 Usage : "Update existing LDAP (simple auth) authentication source" ,
197- Action : func (c * cli.Context ) error {
198- return newAuthService ().updateLdapSimpleAuth (c )
197+ Action : func (ctx context. Context , cmd * cli.Command ) error {
198+ return newAuthService ().updateLdapSimpleAuth (ctx , cmd )
199199 },
200200 Flags : append ([]cli.Flag {idFlag }, ldapSimpleAuthCLIFlags ... ),
201201 }
@@ -212,7 +212,7 @@ func newAuthService() *authService {
212212}
213213
214214// parseAuthSourceLdap assigns values on authSource according to command line flags.
215- func parseAuthSourceLdap (c * cli.Context , authSource * auth.Source ) {
215+ func parseAuthSourceLdap (c * cli.Command , authSource * auth.Source ) {
216216 if c .IsSet ("name" ) {
217217 authSource .Name = c .String ("name" )
218218 }
@@ -232,7 +232,7 @@ func parseAuthSourceLdap(c *cli.Context, authSource *auth.Source) {
232232}
233233
234234// parseLdapConfig assigns values on config according to command line flags.
235- func parseLdapConfig (c * cli.Context , config * ldap.Source ) error {
235+ func parseLdapConfig (c * cli.Command , config * ldap.Source ) error {
236236 if c .IsSet ("name" ) {
237237 config .Name = c .String ("name" )
238238 }
@@ -337,7 +337,7 @@ func findLdapSecurityProtocolByName(name string) (ldap.SecurityProtocol, bool) {
337337
338338// getAuthSource gets the login source by its id defined in the command line flags.
339339// It returns an error if the id is not set, does not match any source or if the source is not of expected type.
340- func (a * authService ) getAuthSource (ctx context.Context , c * cli.Context , authType auth.Type ) (* auth.Source , error ) {
340+ func (a * authService ) getAuthSource (ctx context.Context , c * cli.Command , authType auth.Type ) (* auth.Source , error ) {
341341 if err := argsSet (c , "id" ); err != nil {
342342 return nil , err
343343 }
@@ -355,7 +355,7 @@ func (a *authService) getAuthSource(ctx context.Context, c *cli.Context, authTyp
355355}
356356
357357// addLdapBindDn adds a new LDAP via Bind DN authentication source.
358- func (a * authService ) addLdapBindDn (c * cli.Context ) error {
358+ func (a * authService ) addLdapBindDn (_ context. Context , c * cli.Command ) error {
359359 if err := argsSet (c , "name" , "security-protocol" , "host" , "port" , "user-search-base" , "user-filter" , "email-attribute" ); err != nil {
360360 return err
361361 }
@@ -384,7 +384,7 @@ func (a *authService) addLdapBindDn(c *cli.Context) error {
384384}
385385
386386// updateLdapBindDn updates a new LDAP via Bind DN authentication source.
387- func (a * authService ) updateLdapBindDn (c * cli.Context ) error {
387+ func (a * authService ) updateLdapBindDn (_ context. Context , c * cli.Command ) error {
388388 ctx , cancel := installSignals ()
389389 defer cancel ()
390390
@@ -406,7 +406,7 @@ func (a *authService) updateLdapBindDn(c *cli.Context) error {
406406}
407407
408408// addLdapSimpleAuth adds a new LDAP (simple auth) authentication source.
409- func (a * authService ) addLdapSimpleAuth (c * cli.Context ) error {
409+ func (a * authService ) addLdapSimpleAuth (_ context. Context , c * cli.Command ) error {
410410 if err := argsSet (c , "name" , "security-protocol" , "host" , "port" , "user-dn" , "user-filter" , "email-attribute" ); err != nil {
411411 return err
412412 }
@@ -435,7 +435,7 @@ func (a *authService) addLdapSimpleAuth(c *cli.Context) error {
435435}
436436
437437// updateLdapSimpleAuth updates a new LDAP (simple auth) authentication source.
438- func (a * authService ) updateLdapSimpleAuth (c * cli.Context ) error {
438+ func (a * authService ) updateLdapSimpleAuth (_ context. Context , c * cli.Command ) error {
439439 ctx , cancel := installSignals ()
440440 defer cancel ()
441441
0 commit comments