Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion src/job-frame.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
)

const (
JobFrameVersion = "v3.0.1"
JobFrameVersion = "v3.0.2"
VERSION = JobFrameVersion
APP_NAME = "CIN Framework CLI"
COPYRIGHT_TEXT = "Β© CIN Framework β€” All Rights Reserved."
Expand Down Expand Up @@ -439,6 +439,16 @@ func handleColorCommand(args []string) {
}
}

func requireSudoPermission(commandName string) bool {
if !adminMode {
fmt.Printf("%s[ERROR]%s %sThis command requires administrative privileges%s\n", getColorRed(), getColorReset(), getColorYellow(), getColorReset())
fmt.Printf("%s[INFO]%s %sPlease enable admin mode first using: %ssudo enable%s\n", getColorBlue(), getColorReset(), getColorWhite(), getColorCyan(), getColorReset())
fmt.Printf("%s[SECURITY]%s %sCommand '%s' blocked for security reasons%s\n", getColorMagenta(), getColorReset(), getColorRed(), commandName, getColorReset())
return false
}
return true
}

func handleClearCommand() {
if runtime.GOOS == "windows" {
fmt.Print("\033[2J\033[H")
Expand Down Expand Up @@ -496,6 +506,11 @@ require_once __DIR__ . '/cin/cin.php';
}

func handleRemovePageCommand(args []string) {
// Require sudo permissions for remove operations
if !requireSudoPermission("rep") {
return
}

if len(args) == 0 {
fmt.Printf("%s[ERROR]%s %sPage name is required%s\n", getColorRed(), getColorReset(), getColorYellow(), getColorReset())
fmt.Printf("%sUsage:%s rep [pagename]\n", getColorDim(), getColorReset())
Expand Down Expand Up @@ -697,6 +712,11 @@ func handleInstallFramework(args []string) {
}

func handleDeleteCommand(args []string) {
// Require sudo permissions for delete operations
if !requireSudoPermission("delete") {
return
}

if len(args) == 0 {
fmt.Printf("%s[ERROR]%s Usage: delete [framework|library] [options]\n", getColorRed(), getColorReset())
return
Expand Down