From 0d4d11af2883bac66ecc427cdde37aa995b93ca8 Mon Sep 17 00:00:00 2001 From: Joseph Richey Date: Thu, 19 Oct 2017 02:21:08 -0700 Subject: Random changes --- util/users.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'util/users.go') diff --git a/util/users.go b/util/users.go index 92affa8..49abd32 100644 --- a/util/users.go +++ b/util/users.go @@ -48,3 +48,11 @@ func GetUser(uid int) *user.User { func CurrentUser() *user.User { return GetUser(CurrentUserID()) } + +// CheckIfRoot returns ErrNotRoot if the current user is not the root user. +func CheckIfRoot() error { + if id := CurrentUserID(); id != 0 { + return ErrNotRoot + } + return nil +} -- cgit v1.2.3