Skip to content

Commit

Permalink
Require intent when deleting group through command
Browse files Browse the repository at this point in the history
If you use the /rem command and the affected entry would be a group, you
now have to explicitly specify the entry type (using --type group). The
user will be prompted if they do not do this.

Perhaps this could be improved to seek out users first before groups but
this will do for now.

Finishes implementing #37
Part of the database overhaul included adding support for the --type
argument to the remove command.
  • Loading branch information
Davnit committed Mar 14, 2017
1 parent 02dd5b1 commit 8be01ef
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions trunk/modCommandsAdmin.bas
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,14 @@ Public Sub OnRem(Command As clsCommandObj)
Exit Sub
End If

If StrComp(dbCurrentEntry.EntryType, DB_TYPE_GROUP, vbBinaryCompare) = 0 Then
If InStr(1, Command.Args, Space(1) & CMD_PARAM_PREFIX & "type " & DB_TYPE_GROUP, vbTextCompare) = 0 Then
Command.Respond "An entry with that name was found, but it is a group, and removing it could have unforeseen consequences. " & _
"If you are sure you want to remove it, you need to explicitly specify the type using '--type group'."
Exit Sub
End If
End If

Call Database.RemoveEntry(dbCurrentEntry)
Call Database.Save

Expand Down

0 comments on commit 8be01ef

Please sign in to comment.