KACL Class

Header: #include <KACL>
CMake: find_package(KF6 REQUIRED COMPONENTS KIO)
target_link_libraries(mytarget PRIVATE KF6::KIOCore)

Public Functions

KACL()
KACL(const QString &aclString)
KACL(mode_t basicPermissions)
KACL(const KACL &rhs)
ACLGroupPermissionsList allGroupPermissions() const
ACLUserPermissionsList allUserPermissions() const
QString asString() const
mode_t basePermissions() const
bool isExtended() const
bool isValid() const
unsigned short maskPermissions(bool &exists) const
unsigned short namedGroupPermissions(const QString &name, bool *exists) const
unsigned short namedUserPermissions(const QString &name, bool *exists) const
unsigned short othersPermissions() const
unsigned short ownerPermissions() const
unsigned short owningGroupPermissions() const
bool setACL(const QString &aclStr)
bool setAllGroupPermissions(const ACLGroupPermissionsList &)
bool setAllUserPermissions(const ACLUserPermissionsList &list)
bool setMaskPermissions(unsigned short)
bool setNamedGroupPermissions(const QString &name, unsigned short)
bool setNamedUserPermissions(const QString &name, unsigned short)
bool setOthersPermissions(unsigned short)
bool setOwnerPermissions(unsigned short)
bool setOwningGroupPermissions(unsigned short)

Detailed Description

@class KACL kacl.h <KACL>

The KACL class encapsulates a POSIX Access Control List. It follows the little standard that couldn't, 1003.1e/1003.2c, which died in draft status. @short a POSIX ACL encapsulation @author Till Adam <adam@kde.org>

Member Function Documentation

KACL::KACL()

Creates an empty KACL. Until a valid acl string is set via setACL, isValid() will return false.

KACL::KACL(const QString &aclString)

Creates a new KACL from @p aclString. If the string is a valid acl string, isValid() will afterwards return true.

KACL::KACL(mode_t basicPermissions)

Creates a new KACL from the basic permissions passed in @p basicPermissions. isValid() will return true, afterwards.

KACL::KACL(const KACL &rhs)

Copy ctor

ACLGroupPermissionsList KACL::allGroupPermissions() const

Returns the list of all group permission entries. Each entry consists of a name/permissions pair. This is a QPair, therefore access is provided via the .first and .next members. @return the list of all group permission entries.

See also setAllGroupPermissions().

ACLUserPermissionsList KACL::allUserPermissions() const

Returns the list of all group permission entries. Each entry consists of a name/permissions pair. This is a QPair, therefore access is provided via the .first and .next members. @return the list of all group permission entries.

See also setAllUserPermissions().

QString KACL::asString() const

Return a string representation of the ACL. @return a string version of the ACL in the format compatible with libacl and POSIX 1003.1e. Implementations conforming to that standard should be able to take such strings as input.

mode_t KACL::basePermissions() const

@return the basic (owner/group/others) part of the ACL as a mode_t

bool KACL::isExtended() const

Return whether the ACL contains extended entries or can be expressed using only basic file permissions. @return whether the ACL contains extended entries

bool KACL::isValid() const

Returns whether the KACL object represents a valid acl. @return whether the KACL object represents a valid acl.

unsigned short KACL::maskPermissions(bool &exists) const

Return the entry for the permissions mask if there is one and sets @p exists to true. If there is no such entry, @p exists is set to false. @return the permissions mask entry

See also setMaskPermissions().

unsigned short KACL::namedGroupPermissions(const QString &name, bool *exists) const

Access to the permissions entry for a named group, if such an entry exists. If @p exists is non-null, the boolean variable it points to is set to true if a matching entry exists and to false otherwise. @return the permissions for a group with the name in @p name

See also setNamedGroupPermissions().

unsigned short KACL::namedUserPermissions(const QString &name, bool *exists) const

Access to the permissions entry for a named user, if such an entry exists. If @p exists is non-null, the boolean variable it points to is set to true if a matching entry exists and to false otherwise. @return the permissions for a user entry with the name in @p name

See also setNamedUserPermissions().

unsigned short KACL::othersPermissions() const

@return the permissions entry for others

See also setOthersPermissions().

unsigned short KACL::ownerPermissions() const

@return the owner's permissions entry

See also setOwnerPermissions().

unsigned short KACL::owningGroupPermissions() const

@return the owning group's permissions entry

See also setOwningGroupPermissions().

bool KACL::setACL(const QString &aclStr)

Sets the whole list from a string. If the string in @p aclStr represents a valid ACL, it will be set, otherwise the ACL remains unchanged. @return whether setting the ACL was successful.

bool KACL::setAllGroupPermissions(const ACLGroupPermissionsList &)

Replace the list of all user permissions with @p list. If one of the entries in the list does not exists, or setting of the ACL entry fails for any reason, the ACL will be left unchanged. @return success or failure

See also allGroupPermissions().

bool KACL::setAllUserPermissions(const ACLUserPermissionsList &list)

Replace the list of all user permissions with @p list. If one of the entries in the list does not exists, or setting of the ACL entry fails for any reason, the ACL will be left unchanged. @return success or failure

See also allUserPermissions().

bool KACL::setMaskPermissions(unsigned short)

Set the permissions mask for the ACL. Permissions set for individual entries will be masked with this, such that their effective permissions are the result of the logical and of their entry and the mask. @return success or failure

See also maskPermissions().

bool KACL::setNamedGroupPermissions(const QString &name, unsigned short)

Set the permissions for a group with the name @p name. Will fail if the group doesn't exist, in which case the ACL be unchanged. @return success or failure.

See also namedGroupPermissions().

bool KACL::setNamedUserPermissions(const QString &name, unsigned short)

Set the permissions for a user with the name @p name. Will fail if the user doesn't exist, in which case the ACL will be unchanged. @return success or failure.

See also namedUserPermissions().

bool KACL::setOthersPermissions(unsigned short)

Set the permissions entry for others. @return success or failure

See also othersPermissions().

bool KACL::setOwnerPermissions(unsigned short)

Set the owner's permissions entry. @return success or failure

See also ownerPermissions().

bool KACL::setOwningGroupPermissions(unsigned short)

Set the owning group's permissions entry. @return success or failure

See also owningGroupPermissions().