KUserGroup

Search for usage in LXR

#include <KUserGroup>

Public Member Functions

 KUserGroup (const char *name)
 
 KUserGroup (const group *g)
 
 KUserGroup (const KUserGroup &group)
 
 KUserGroup (const QString &name)
 
 KUserGroup (K_GID gid)
 
 KUserGroup (KGroupId gid)
 
 KUserGroup (KUser::UIDMode mode=KUser::UseEffectiveUID)
 
 ~KUserGroup ()
 
KGroupId groupId () const
 
bool isValid () const
 
QString name () const
 
bool operator!= (const KUserGroup &group) const
 
KUserGroupoperator= (const KUserGroup &group)
 
bool operator== (const KUserGroup &group) const
 
QStringList userNames (uint maxCount=KCOREADDONS_UINT_MAX) const
 
QList< KUserusers (uint maxCount=KCOREADDONS_UINT_MAX) const
 

Static Public Member Functions

static QStringList allGroupNames (uint maxCount=KCOREADDONS_UINT_MAX)
 
static QList< KUserGroupallGroups (uint maxCount=KCOREADDONS_UINT_MAX)
 

Detailed Description

Represents a group on your system.

This class represents a group on your system. You can either get information about the group of the current user, of fetch information about a group on the system. Instances of this class will be explicitly shared, so copying objects is very cheap and you can safely pass objects by value.

Author
Jan Schaefer j_sch.nosp@m.aef@.nosp@m.infor.nosp@m.mati.nosp@m.k.uni.nosp@m.-kl..nosp@m.de

Definition at line 423 of file kuser.h.

Constructor & Destructor Documentation

◆ KUserGroup() [1/7]

KUserGroup::KUserGroup ( const QString & name)
explicit

Create an object from a group name.

If the group does not exist, isValid() will return false.

Parameters
namethe name of the group

Definition at line 449 of file kuser_unix.cpp.

◆ KUserGroup() [2/7]

KUserGroup::KUserGroup ( const char * name)
explicit

Create an object from a group name.

If the group does not exist, isValid() will return false.

Parameters
namethe name of the group

Definition at line 454 of file kuser_unix.cpp.

◆ KUserGroup() [3/7]

KUserGroup::KUserGroup ( KGroupId gid)
explicit

Creates an object for the group with the given group id.

If the KGroupId object is invalid this one will be, too.

Parameters
gidthe group id

Definition at line 444 of file kuser_unix.cpp.

◆ KUserGroup() [4/7]

KUserGroup::KUserGroup ( KUser::UIDMode mode = KUser::UseEffectiveUID)
explicit

Create an object from the group of the current user.

Parameters
modeif KUser::UseEffectiveUID is passed the effective user will be used. If KUser::UseRealUserID is passed the real user will be used. The real UID will be different than the effective UID in setuid programs; in such a case use the effective UID for checking permissions, and the real UID for displaying information about the group associated with the user.

Definition at line 434 of file kuser_unix.cpp.

◆ KUserGroup() [5/7]

KUserGroup::KUserGroup ( K_GID gid)
explicit

Create an object from a group id.

If the group does not exist, isValid() will return false.

Parameters
gidthe group id

Definition at line 439 of file kuser_unix.cpp.

◆ KUserGroup() [6/7]

KUserGroup::KUserGroup ( const group * g)
explicit

Creates an object from a group structure.

If the pointer is null, isValid() will return false.

Parameters
gthe group structure to create the group from.

◆ KUserGroup() [7/7]

KUserGroup::KUserGroup ( const KUserGroup & group)

Creates a new KUserGroup instance from another KUserGroup object.

Parameters
groupthe KUserGroup to copy

Definition at line 464 of file kuser_unix.cpp.

◆ ~KUserGroup()

KUserGroup::~KUserGroup ( )

Destructor.

Definition at line 583 of file kuser_unix.cpp.

Member Function Documentation

◆ allGroupNames()

QStringList KUserGroup::allGroupNames ( uint maxCount = KCOREADDONS_UINT_MAX)
static
Parameters
maxCountthe maximum number of groups to return
Returns
a list of all group names on this system

Definition at line 567 of file kuser_unix.cpp.

◆ allGroups()

QList< KUserGroup > KUserGroup::allGroups ( uint maxCount = KCOREADDONS_UINT_MAX)
static
Parameters
maxCountthe maximum number of groups to return
Returns
a list of all groups on this system

Definition at line 551 of file kuser_unix.cpp.

◆ groupId()

KGroupId KUserGroup::groupId ( ) const
Returns
the native group id of the user.

Definition at line 485 of file kuser_unix.cpp.

◆ isValid()

bool KUserGroup::isValid ( ) const

Returns whether the group is valid.

A KUserGroup object can be invalid if it is created with a non-existing gid or name.

Returns
true if the group is valid

Definition at line 480 of file kuser_unix.cpp.

◆ name()

QString KUserGroup::name ( ) const

The name of the group.

Returns
the name of the group

Definition at line 490 of file kuser_unix.cpp.

◆ operator!=()

bool KUserGroup::operator!= ( const KUserGroup & group) const
inline

Two KUserGroup objects are not equal if their gid()s are not identical.

Invalid groups always compare unequal.

Returns
true if the groups are not identical

Definition at line 613 of file kuser.h.

◆ operator=()

KUserGroup & KUserGroup::operator= ( const KUserGroup & group)

Copies a group.

Parameters
groupthe group that should be copied
Returns
this group

Definition at line 469 of file kuser_unix.cpp.

◆ operator==()

bool KUserGroup::operator== ( const KUserGroup & group) const

Two KUserGroup objects are equal if their gid()s are identical.

Invalid groups never compare equal.

Returns
true if the groups are identical

Definition at line 475 of file kuser_unix.cpp.

◆ userNames()

QStringList KUserGroup::userNames ( uint maxCount = KCOREADDONS_UINT_MAX) const
Parameters
maxCountthe maximum number of groups to return
Returns
a list of all user login names of the group

Definition at line 542 of file kuser_unix.cpp.

◆ users()

QList< KUser > KUserGroup::users ( uint maxCount = KCOREADDONS_UINT_MAX) const
Parameters
maxCountthe maximum number of users to return
Returns
a list of all users of the group

Definition at line 533 of file kuser_unix.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 13 2024 11:49:19 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.