'Verify only the user has permissions to operate on the supplied path.
Args:
path [string]: Path to local file.'

def verify_user_access_only(self, path):

    if ((not path) or (not os.path.exists(path))):
        return True
    ok = True
    stat = os.stat(path)
    if (stat.st_mode & 63):
        self.__errors.append('"{path}"    should    not    have    non-owner    access.    Mode    is    {mode}.'.format(path=path, mode=('%03o' % (stat.st_mode & 4095))))
        ok = False
    owned_by = pwd.getpwuid(stat.st_uid).pw_name
    run_by = pwd.getpwuid(os.getuid()).pw_name
    if (not os.geteuid()):
        if (owned_by != 'spinnaker'):
            self.__errors.append('"{path}"    should    be    owned    by    "spinnaker"    assuming    you    run    Spinnaker    as    user    "spinnaker".    Otherwise    rerun    this    command    as    the    user    you    run    Spinnaker    as.')
    elif (owned_by != run_by):
        self.__errors.append('"{path}"    should    be    owned    by    user    "{run_by}"    since    you    are    running    as    {run_by}.    It    could    also    be    that    you    intended    to    run    this    command    as    user    "{owned_by}".'.format(path=path, run_by=run_by, owned_by=owned_by))
        ok = False
    return ok
