Skip to content
This repository has been archived by the owner on Nov 8, 2019. It is now read-only.

Commit

Permalink
Merge pull request #35 from ingrammicro/bugfix/34-windows-admin-rights
Browse files Browse the repository at this point in the history
Fallback check for windows administration rights (issue #34)
  • Loading branch information
Pablo Baños López authored Apr 5, 2018
2 parents f7e6957 + 119c19a commit 56aea15
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion utils/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ func (config *Config) evaluateCurrentUser() (*user.User, error) {
if runtime.GOOS == "windows" {
currUser.Username = currUser.Username[strings.LastIndex(currUser.Username, "\\")+1:]
log.Debugf("Windows username is %s", currUser.Username)
config.CurrentUserIsAdmin = (currUser.Gid == "S-1-5-32-544" || isWinAdministrator(currUser.Username))
config.CurrentUserIsAdmin = (currUser.Gid == "S-1-5-32-544" || isWinAdministrator(currUser.Username) || canPerformAdministratorTasks())
} else {
config.CurrentUserIsAdmin = (currUser.Uid == "0" || currUser.Username == "root")
}
Expand Down Expand Up @@ -349,6 +349,15 @@ func isWinAdministrator(user string) bool {
user == "imco"
}

func canPerformAdministratorTasks() bool {
f, err := os.Open("\\\\.\\PHYSICALDRIVE0")
if err != nil {
return false
}
defer f.Close()
return true
}

// readConcertoURL reads URL from CONCERTO_URL envrionment or calculates using API URL
func (config *Config) readConcertoURL() error {

Expand Down

0 comments on commit 56aea15

Please sign in to comment.