Skip to content
Browse files

Require intent when deleting group through command

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 8be01ef911d1e381a85fdf406564854b4a680ae8
Showing with 8 additions and 0 deletions.
  1. +8 −0 trunk/modCommandsAdmin.bas
@@ -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

0 comments on commit 8be01ef

Please sign in to comment.
You can’t perform that action at this time.