diff options
| author | Joseph Richey <joerichey94@gmail.com> | 2017-10-19 02:21:08 -0700 |
|---|---|---|
| committer | Joseph Richey <joerichey94@gmail.com> | 2017-10-19 02:22:29 -0700 |
| commit | 0d4d11af2883bac66ecc427cdde37aa995b93ca8 (patch) | |
| tree | be426d602b210d91a3e0121ad4757dad8fef44cd /util/users.go | |
| parent | 18925df4483ccf5c48dfb4314f85c1b37a1cbe81 (diff) | |
Random changesext4
Diffstat (limited to 'util/users.go')
| -rw-r--r-- | util/users.go | 8 |
1 files changed, 8 insertions, 0 deletions
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 +} |