pkg.re/essentialkaos/ek.10@v12.41.0+incompatible/system/user_windows.go (about)

     1  package system
     2  
     3  // ////////////////////////////////////////////////////////////////////////////////// //
     4  //                                                                                    //
     5  //                         Copyright (c) 2022 ESSENTIAL KAOS                          //
     6  //      Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0>     //
     7  //                                                                                    //
     8  // ////////////////////////////////////////////////////////////////////////////////// //
     9  
    10  import (
    11  	"time"
    12  )
    13  
    14  // ////////////////////////////////////////////////////////////////////////////////// //
    15  
    16  // ❗ User contains information about user
    17  type User struct {
    18  	UID      int      `json:"uid"`
    19  	GID      int      `json:"gid"`
    20  	Name     string   `json:"name"`
    21  	Groups   []*Group `json:"groups"`
    22  	Comment  string   `json:"comment"`
    23  	Shell    string   `json:"shell"`
    24  	HomeDir  string   `json:"home_dir"`
    25  	RealUID  int      `json:"real_uid"`
    26  	RealGID  int      `json:"real_gid"`
    27  	RealName string   `json:"real_name"`
    28  }
    29  
    30  // ❗ Group contains information about group
    31  type Group struct {
    32  	Name string `json:"name"`
    33  	GID  int    `json:"gid"`
    34  }
    35  
    36  // ❗ SessionInfo contains information about all sessions
    37  type SessionInfo struct {
    38  	User             *User     `json:"user"`
    39  	LoginTime        time.Time `json:"login_time"`
    40  	LastActivityTime time.Time `json:"last_activity_time"`
    41  }
    42  
    43  // ////////////////////////////////////////////////////////////////////////////////// //
    44  
    45  // ❗ Who returns info about all active sessions sorted by login time
    46  func Who() ([]*SessionInfo, error) {
    47  	panic("UNSUPPORTED")
    48  	return nil, nil
    49  }
    50  
    51  // ❗ CurrentUser returns struct with info about current user
    52  func CurrentUser(avoidCache ...bool) (*User, error) {
    53  	panic("UNSUPPORTED")
    54  	return nil, nil
    55  }
    56  
    57  // ❗ LookupUser searches user info by given name
    58  func LookupUser(name string) (*User, error) {
    59  	panic("UNSUPPORTED")
    60  	return nil, nil
    61  }
    62  
    63  // ❗ LookupGroup searches group info by given name
    64  func LookupGroup(name string) (*Group, error) {
    65  	panic("UNSUPPORTED")
    66  	return nil, nil
    67  }
    68  
    69  // ❗ IsUserExist checks if user exist on system or not
    70  func IsUserExist(name string) bool {
    71  	panic("UNSUPPORTED")
    72  	return false
    73  }
    74  
    75  // ❗ IsGroupExist checks if group exist on system or not
    76  func IsGroupExist(name string) bool {
    77  	panic("UNSUPPORTED")
    78  	return false
    79  }
    80  
    81  // ////////////////////////////////////////////////////////////////////////////////// //
    82  
    83  // ❗ IsRoot checks if current user is root
    84  func (u *User) IsRoot() bool {
    85  	panic("UNSUPPORTED")
    86  	return false
    87  }
    88  
    89  // ❗ IsSudo checks if it user over sudo command
    90  func (u *User) IsSudo() bool {
    91  	panic("UNSUPPORTED")
    92  	return false
    93  }
    94  
    95  // ❗ GroupList returns slice with user groups names
    96  func (u *User) GroupList() []string {
    97  	panic("UNSUPPORTED")
    98  	return nil
    99  }