Forráskód Böngészése

Removed Inactive User Deletion

Yoginth 7 éve
szülő
commit
0ac4cdee0b
4 módosított fájl, 0 hozzáadás és 41 törlés
  1. 0 13
      cmd/admin.go
  2. 0 21
      models/user.go
  3. 0 3
      routes/admin/admin.go
  4. 0 4
      templates/admin/dashboard.tmpl

+ 0 - 13
cmd/admin.go

@@ -17,7 +17,6 @@ var (
 		Description: "Perform admin operations on command line",
 		Subcommands: []cli.Command{
 			subcmdCreateUser,
-			subcmdDeleteInactivateUsers,
 			subcmdDeleteRepositoryArchives,
 			subcmdDeleteMissingRepositories,
 			subcmdGitGcRepos,
@@ -40,18 +39,6 @@ var (
 		},
 	}
 
-	subcmdDeleteInactivateUsers = cli.Command{
-		Name:  "delete-inactive-users",
-		Usage: "Delete all inactive accounts",
-		Action: adminDashboardOperation(
-			models.DeleteInactivateUsers,
-			"All inactivate accounts have been deleted successfully",
-		),
-		Flags: []cli.Flag{
-			stringFlag("config, c", "custom/conf/app.ini", "Custom configuration file path"),
-		},
-	}
-
 	subcmdDeleteRepositoryArchives = cli.Command{
 		Name:  "delete-repository-archives",
 		Usage: "Delete all repositories archives",

+ 0 - 21
models/user.go

@@ -892,27 +892,6 @@ func DeleteUser(u *User) (err error) {
 	return RewriteAuthorizedKeys()
 }
 
-// DeleteInactivateUsers deletes all inactivate users and email addresses.
-func DeleteInactivateUsers() (err error) {
-	users := make([]*User, 0, 10)
-	if err = x.Where("is_active = ?", false).Find(&users); err != nil {
-		return fmt.Errorf("get all inactive users: %v", err)
-	}
-	// FIXME: should only update authorized_keys file once after all deletions.
-	for _, u := range users {
-		if err = DeleteUser(u); err != nil {
-			// Ignore users that were set inactive by admin.
-			if IsErrUserOwnRepos(err) || IsErrUserHasOrgs(err) {
-				continue
-			}
-			return err
-		}
-	}
-
-	_, err = x.Where("is_activated = ?", false).Delete(new(EmailAddress))
-	return err
-}
-
 // UserPath returns the path absolute path of user repositories.
 func UserPath(userName string) string {
 	return filepath.Join(setting.RepoRootPath, strings.ToLower(userName))

+ 0 - 3
routes/admin/admin.go

@@ -134,9 +134,6 @@ func Dashboard(c *context.Context) {
 		var success string
 
 		switch AdminOperation(op) {
-		case CLEAN_INACTIVATE_USER:
-			success = "All inactivate accounts have been deleted successfully."
-			err = models.DeleteInactivateUsers()
 		case CLEAN_REPO_ARCHIVES:
 			success = "All repositories archives have been deleted successfully."
 			err = models.DeleteRepositoryArchives()

+ 0 - 4
templates/admin/dashboard.tmpl

@@ -103,10 +103,6 @@
 				<div class="ui unstackable attached table segment">
 					<table class="ui unstackable very basic table">
 						<tbody>
-							<tr>
-								<td>Delete all inactive accounts</td>
-								<td><a href="{{AppSubURL}}/admin?op=1">Run</a></td>
-							</tr>
 							<tr>
 								<td>Delete all repositories archives</td>
 								<td><a href="{{AppSubURL}}/admin?op=2">Run</a></td>