osidm

package
v0.33.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package osidm implements an identity manager using os functions.

For testing only, should not be used in a production environment.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetUser added in v0.3.2

func SetUser(name string) (avfs.UserReader, error)

func User

func User() avfs.UserReader

User returns the current user of the OS.

Types

type OsGroup added in v0.3.2

type OsGroup struct {
	// contains filtered or unexported fields
}

OsGroup is the implementation of avfs.GroupReader.

func (*OsGroup) Gid added in v0.3.2

func (g *OsGroup) Gid() int

Gid returns the group ID.

func (*OsGroup) Name added in v0.3.2

func (g *OsGroup) Name() string

Name returns the group name.

type OsIdm

type OsIdm struct {
	// contains filtered or unexported fields
}

OsIdm implements a rudimentary identity manager using the avfs.IdentityMgr interface.

func New

func New() *OsIdm

New creates a new OsIdm identity manager.

func (*OsIdm) AdminGroup added in v0.3.2

func (idm *OsIdm) AdminGroup() avfs.GroupReader

AdminGroup returns the administrator (root) group.

func (*OsIdm) AdminUser added in v0.3.2

func (idm *OsIdm) AdminUser() avfs.UserReader

AdminUser returns the administrator (root) user.

func (*OsIdm) Features added in v0.2.0

func (idm *OsIdm) Features() avfs.Features

Features returns the set of features provided by the file system or identity manager.

func (*OsIdm) GroupAdd

func (idm *OsIdm) GroupAdd(name string) (avfs.GroupReader, error)

GroupAdd adds a new group.

func (*OsIdm) GroupDel

func (idm *OsIdm) GroupDel(name string) error

GroupDel deletes an existing group.

func (*OsIdm) HasFeature added in v0.2.0

func (idm *OsIdm) HasFeature(feature avfs.Features) bool

HasFeature returns true if the file system or identity manager provides a given feature.

func (*OsIdm) LookupGroup

func (idm *OsIdm) LookupGroup(name string) (avfs.GroupReader, error)

LookupGroup looks up a group by name. If the group cannot be found, the returned error is of type UnknownGroupError.

func (*OsIdm) LookupGroupId

func (idm *OsIdm) LookupGroupId(gid int) (avfs.GroupReader, error)

LookupGroupId looks up a group by groupid. If the group cannot be found, the returned error is of type UnknownGroupIdError.

func (*OsIdm) LookupUser

func (idm *OsIdm) LookupUser(name string) (avfs.UserReader, error)

LookupUser looks up a user by username. If the user cannot be found, the returned error is of type UnknownUserError.

func (*OsIdm) LookupUserId

func (idm *OsIdm) LookupUserId(uid int) (avfs.UserReader, error)

LookupUserId looks up a user by userid. If the user cannot be found, the returned error is of type UnknownUserIdError.

func (*OsIdm) OSType added in v0.3.2

func (idm *OsIdm) OSType() avfs.OSType

OSType returns the operating system type of the identity manager.

func (*OsIdm) SetUser added in v0.3.2

func (idm *OsIdm) SetUser(name string) (avfs.UserReader, error)

SetUser sets and returns the current user. If the user is not found, the returned error is of type UnknownUserError.

func (*OsIdm) Type

func (idm *OsIdm) Type() string

Type returns the type of the fileSystem or Identity manager.

func (*OsIdm) User

func (idm *OsIdm) User() avfs.UserReader

User returns the current user.

func (*OsIdm) UserAdd

func (idm *OsIdm) UserAdd(name, groupName string) (avfs.UserReader, error)

UserAdd adds a new user.

func (*OsIdm) UserDel

func (idm *OsIdm) UserDel(name string) error

UserDel deletes an existing user.

type OsUser added in v0.3.2

type OsUser struct {
	// contains filtered or unexported fields
}

OsUser is the implementation of avfs.UserReader.

func (*OsUser) Gid added in v0.3.2

func (u *OsUser) Gid() int

Gid returns the primary group ID of the user.

func (*OsUser) IsAdmin added in v0.3.2

func (u *OsUser) IsAdmin() bool

IsAdmin returns true if the user has administrator (root) privileges.

func (*OsUser) Name added in v0.3.2

func (u *OsUser) Name() string

Name returns the user name.

func (*OsUser) Uid added in v0.3.2

func (u *OsUser) Uid() int

Uid returns the user ID.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL