github.com/avfs/avfs@v0.33.1-0.20240303173310-c6ba67c33eb7/idm/osidm/osidm_other.go (about)

     1  //
     2  //  Copyright 2020 The AVFS authors
     3  //
     4  //  Licensed under the Apache License, Version 2.0 (the "License");
     5  //  you may not use this file except in compliance with the License.
     6  //  You may obtain a copy of the License at
     7  //
     8  //  	http://www.apache.org/licenses/LICENSE-2.0
     9  //
    10  //  Unless required by applicable law or agreed to in writing, software
    11  //  distributed under the License is distributed on an "AS IS" BASIS,
    12  //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  //  See the License for the specific language governing permissions and
    14  //  limitations under the License.
    15  //
    16  
    17  //go:build !linux
    18  
    19  package osidm
    20  
    21  import (
    22  	"github.com/avfs/avfs"
    23  )
    24  
    25  // GroupAdd adds a new group.
    26  func (idm *OsIdm) GroupAdd(name string) (avfs.GroupReader, error) {
    27  	return nil, avfs.ErrPermDenied
    28  }
    29  
    30  // GroupDel deletes an existing group.
    31  func (idm *OsIdm) GroupDel(name string) error {
    32  	return avfs.ErrPermDenied
    33  }
    34  
    35  // LookupGroup looks up a group by name. If the group cannot be found, the
    36  // returned error is of type UnknownGroupError.
    37  func (idm *OsIdm) LookupGroup(name string) (avfs.GroupReader, error) {
    38  	return nil, avfs.ErrPermDenied
    39  }
    40  
    41  // LookupGroupId looks up a group by groupid. If the group cannot be found, the
    42  // returned error is of type UnknownGroupIdError.
    43  func (idm *OsIdm) LookupGroupId(gid int) (avfs.GroupReader, error) {
    44  	return nil, avfs.ErrPermDenied
    45  }
    46  
    47  // LookupUser looks up a user by username. If the user cannot be found, the
    48  // returned error is of type UnknownUserError.
    49  func (idm *OsIdm) LookupUser(name string) (avfs.UserReader, error) {
    50  	return nil, avfs.ErrPermDenied
    51  }
    52  
    53  // LookupUserId looks up a user by userid. If the user cannot be found, the
    54  // returned error is of type UnknownUserIdError.
    55  func (idm *OsIdm) LookupUserId(uid int) (avfs.UserReader, error) {
    56  	return nil, avfs.ErrPermDenied
    57  }
    58  
    59  // SetUser sets the current user.
    60  // If the user can't be changed an error is returned.
    61  func SetUser(user avfs.UserReader) error {
    62  	return avfs.ErrPermDenied
    63  }
    64  
    65  // SetUserByName sets the current user by name.
    66  // If the user is not found, the returned error is of type UnknownUserError.
    67  func SetUserByName(name string) error {
    68  	return avfs.ErrPermDenied
    69  }
    70  
    71  // User returns the current user of the OS.
    72  func User() avfs.UserReader {
    73  	return avfs.NotImplementedIdm.AdminUser()
    74  }
    75  
    76  // UserAdd adds a new user.
    77  func (idm *OsIdm) UserAdd(name, groupName string) (avfs.UserReader, error) {
    78  	return nil, avfs.ErrPermDenied
    79  }
    80  
    81  // UserDel deletes an existing user.
    82  func (idm *OsIdm) UserDel(name string) error {
    83  	return avfs.ErrPermDenied
    84  }
    85  
    86  // IsUserAdmin returns true if the current user has admin privileges.
    87  func isUserAdmin() bool {
    88  	return false
    89  }