• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KIO

  • sources
  • kde-4.12
  • kdelibs
  • kio
  • kio
kacl.cpp
Go to the documentation of this file.
1 /* This file is part of the KDE project
2  Copyright (C) 2005 - 2007 Till Adam <adam@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 // $Id: kacl.cpp 424977 2005-06-13 15:13:22Z tilladam $
20 
21 #include "kacl.h"
22 
23 #include <config-acl.h>
24 
25 #include <sys/types.h>
26 #include <pwd.h>
27 #include <grp.h>
28 #include <sys/stat.h>
29 #ifdef HAVE_POSIX_ACL
30 #include <sys/acl.h>
31 #include <acl/libacl.h>
32 #endif
33 #include <QHash>
34 
35 #include <kdebug.h>
36 
37 #include <QList>
38 #include <QPair>
39 
40 
41 class KACL::KACLPrivate {
42 public:
43  KACLPrivate() : m_acl( 0 ) {}
44 #ifdef HAVE_POSIX_ACL
45  KACLPrivate( acl_t acl )
46  : m_acl( acl ) {}
47  ~KACLPrivate() { if ( m_acl ) acl_free( m_acl ); }
48 #endif
49  // helpers
50 #ifdef HAVE_POSIX_ACL
51  bool setMaskPermissions( unsigned short v );
52  QString getUserName( uid_t uid ) const;
53  QString getGroupName( gid_t gid ) const;
54  bool setAllUsersOrGroups( const QList< QPair<QString, unsigned short> > &list, acl_tag_t type );
55  bool setNamedUserOrGroupPermissions( const QString& name, unsigned short permissions, acl_tag_t type );
56 
57  acl_t m_acl;
58 #else
59  int m_acl;
60 #endif
61  mutable QHash<uid_t, QString> m_usercache;
62  mutable QHash<gid_t, QString> m_groupcache;
63 };
64 
65 KACL::KACL( const QString &aclString )
66  : d( new KACLPrivate )
67 {
68  setACL( aclString );
69 }
70 
71 KACL::KACL( mode_t basePermissions )
72 #ifdef HAVE_POSIX_ACL
73  : d( new KACLPrivate( acl_from_mode( basePermissions ) ) )
74 #else
75  : d( new KACLPrivate )
76 #endif
77 {
78 #ifndef HAVE_POSIX_ACL
79  Q_UNUSED( basePermissions );
80 #endif
81 }
82 
83 KACL::KACL()
84  : d( new KACLPrivate )
85 {
86 }
87 
88 KACL::KACL( const KACL& rhs )
89  : d( new KACLPrivate )
90 {
91  setACL( rhs.asString() );
92 }
93 
94 KACL::~KACL()
95 {
96  delete d;
97 }
98 
99 KACL& KACL::operator=( const KACL& rhs )
100 {
101  if ( this != &rhs )
102  setACL( rhs.asString() );
103  return *this;
104 }
105 
106 bool KACL::operator==( const KACL& rhs ) const {
107 #ifdef HAVE_POSIX_ACL
108  return ( acl_cmp( d->m_acl, rhs.d->m_acl ) == 0 );
109 #else
110  Q_UNUSED( rhs );
111  return true;
112 #endif
113 }
114 
115 bool KACL::operator!=( const KACL& rhs ) const
116 {
117  return !operator==( rhs );
118 }
119 
120 bool KACL::isValid() const
121 {
122  bool valid = false;
123 #ifdef HAVE_POSIX_ACL
124  if ( d->m_acl ) {
125  valid = ( acl_valid( d->m_acl ) == 0 );
126  }
127 #endif
128  return valid;
129 }
130 
131 bool KACL::isExtended() const
132 {
133 #ifdef HAVE_POSIX_ACL
134  return ( acl_equiv_mode( d->m_acl, NULL ) != 0 );
135 #else
136  return false;
137 #endif
138 }
139 
140 #ifdef HAVE_POSIX_ACL
141 static acl_entry_t entryForTag( acl_t acl, acl_tag_t tag )
142 {
143  acl_entry_t entry;
144  int ret = acl_get_entry( acl, ACL_FIRST_ENTRY, &entry );
145  while ( ret == 1 ) {
146  acl_tag_t currentTag;
147  acl_get_tag_type( entry, &currentTag );
148  if ( currentTag == tag )
149  return entry;
150  ret = acl_get_entry( acl, ACL_NEXT_ENTRY, &entry );
151  }
152  return 0;
153 }
154 
155 static unsigned short entryToPermissions( acl_entry_t entry )
156 {
157  if ( entry == 0 ) return 0;
158  acl_permset_t permset;
159  if ( acl_get_permset( entry, &permset ) != 0 ) return 0;
160  return( acl_get_perm( permset, ACL_READ ) << 2 |
161  acl_get_perm( permset, ACL_WRITE ) << 1 |
162  acl_get_perm( permset, ACL_EXECUTE ) );
163 }
164 
165 static void permissionsToEntry( acl_entry_t entry, unsigned short v )
166 {
167  if ( entry == 0 ) return;
168  acl_permset_t permset;
169  if ( acl_get_permset( entry, &permset ) != 0 ) return;
170  acl_clear_perms( permset );
171  if ( v & 4 ) acl_add_perm( permset, ACL_READ );
172  if ( v & 2 ) acl_add_perm( permset, ACL_WRITE );
173  if ( v & 1 ) acl_add_perm( permset, ACL_EXECUTE );
174 }
175 
176 #ifdef HAVE_POSIX_ACL
177 #if 0
178 static void printACL( acl_t acl, const QString &comment )
179 {
180  const char* txt = acl_to_text(acl);
181  kDebug() << comment << txt;
182  acl_free(txt);
183 }
184 #endif
185 #endif
186 
187 static int getUidForName( const QString& name )
188 {
189  struct passwd *user = getpwnam( name.toLocal8Bit() );
190  if ( user )
191  return user->pw_uid;
192  else
193  return -1;
194 }
195 
196 static int getGidForName( const QString& name )
197 {
198  struct group *group = getgrnam( name.toLocal8Bit() );
199  if ( group )
200  return group->gr_gid;
201  else
202  return -1;
203 }
204 #endif
205 // ------------------ begin API implementation ------------
206 
207 unsigned short KACL::ownerPermissions() const
208 {
209 #ifdef HAVE_POSIX_ACL
210  return entryToPermissions( entryForTag( d->m_acl, ACL_USER_OBJ ) );
211 #else
212  return 0;
213 #endif
214 }
215 
216 bool KACL::setOwnerPermissions( unsigned short v )
217 {
218 #ifdef HAVE_POSIX_ACL
219  permissionsToEntry( entryForTag( d->m_acl, ACL_USER_OBJ ), v );
220 #else
221  Q_UNUSED( v );
222 #endif
223  return true;
224 }
225 
226 unsigned short KACL::owningGroupPermissions() const
227 {
228 #ifdef HAVE_POSIX_ACL
229  return entryToPermissions( entryForTag( d->m_acl, ACL_GROUP_OBJ ) );
230 #else
231  return 0;
232 #endif
233 }
234 
235 bool KACL::setOwningGroupPermissions( unsigned short v )
236 {
237 #ifdef HAVE_POSIX_ACL
238  permissionsToEntry( entryForTag( d->m_acl, ACL_GROUP_OBJ ), v );
239 #else
240  Q_UNUSED( v );
241 #endif
242  return true;
243 }
244 
245 unsigned short KACL::othersPermissions() const
246 {
247 #ifdef HAVE_POSIX_ACL
248  return entryToPermissions( entryForTag( d->m_acl, ACL_OTHER ) );
249 #else
250  return 0;
251 #endif
252 }
253 
254 bool KACL::setOthersPermissions( unsigned short v )
255 {
256 #ifdef HAVE_POSIX_ACL
257  permissionsToEntry( entryForTag( d->m_acl, ACL_OTHER ), v );
258 #else
259  Q_UNUSED( v );
260 #endif
261  return true;
262 }
263 
264 mode_t KACL::basePermissions() const
265 {
266  mode_t perms( 0 );
267 #ifdef HAVE_POSIX_ACL
268  if ( ownerPermissions() & ACL_READ ) perms |= S_IRUSR;
269  if ( ownerPermissions() & ACL_WRITE ) perms |= S_IWUSR;
270  if ( ownerPermissions() & ACL_EXECUTE ) perms |= S_IXUSR;
271  if ( owningGroupPermissions() & ACL_READ ) perms |= S_IRGRP;
272  if ( owningGroupPermissions() & ACL_WRITE ) perms |= S_IWGRP;
273  if ( owningGroupPermissions() & ACL_EXECUTE ) perms |= S_IXGRP;
274  if ( othersPermissions() & ACL_READ ) perms |= S_IROTH;
275  if ( othersPermissions() & ACL_WRITE ) perms |= S_IWOTH;
276  if ( othersPermissions() & ACL_EXECUTE ) perms |= S_IXOTH;
277 #endif
278  return perms;
279 }
280 
281 unsigned short KACL::maskPermissions( bool &exists ) const
282 {
283  exists = true;
284 #ifdef HAVE_POSIX_ACL
285  acl_entry_t entry = entryForTag( d->m_acl, ACL_MASK );
286  if ( entry == 0 ) {
287  exists = false;
288  return 0;
289  }
290  return entryToPermissions( entry );
291 #else
292  return 0;
293 #endif
294 }
295 
296 #ifdef HAVE_POSIX_ACL
297 bool KACL::KACLPrivate::setMaskPermissions( unsigned short v )
298 {
299  acl_entry_t entry = entryForTag( m_acl, ACL_MASK );
300  if ( entry == 0 ) {
301  acl_create_entry( &m_acl, &entry );
302  acl_set_tag_type( entry, ACL_MASK );
303  }
304  permissionsToEntry( entry, v );
305  return true;
306 }
307 #endif
308 
309 bool KACL::setMaskPermissions( unsigned short v )
310 {
311 #ifdef HAVE_POSIX_ACL
312  return d->setMaskPermissions( v );
313 #else
314  Q_UNUSED( v );
315  return true;
316 #endif
317 }
318 
319 /**************************
320  * Deal with named users *
321  **************************/
322 unsigned short KACL::namedUserPermissions( const QString& name, bool *exists ) const
323 {
324 #ifdef HAVE_POSIX_ACL
325  acl_entry_t entry;
326  uid_t id;
327  *exists = false;
328  int ret = acl_get_entry( d->m_acl, ACL_FIRST_ENTRY, &entry );
329  while ( ret == 1 ) {
330  acl_tag_t currentTag;
331  acl_get_tag_type( entry, &currentTag );
332  if ( currentTag == ACL_USER ) {
333  id = *( (uid_t*) acl_get_qualifier( entry ) );
334  if ( d->getUserName( id ) == name ) {
335  *exists = true;
336  return entryToPermissions( entry );
337  }
338  }
339  ret = acl_get_entry( d->m_acl, ACL_NEXT_ENTRY, &entry );
340  }
341 #else
342  Q_UNUSED( name );
343  Q_UNUSED( exists );
344 #endif
345  return 0;
346 }
347 
348 #ifdef HAVE_POSIX_ACL
349 bool KACL::KACLPrivate::setNamedUserOrGroupPermissions( const QString& name, unsigned short permissions, acl_tag_t type )
350 {
351  bool allIsWell = true;
352  acl_t newACL = acl_dup( m_acl );
353  acl_entry_t entry;
354  bool createdNewEntry = false;
355  bool found = false;
356  int ret = acl_get_entry( newACL, ACL_FIRST_ENTRY, &entry );
357  while ( ret == 1 ) {
358  acl_tag_t currentTag;
359  acl_get_tag_type( entry, &currentTag );
360  if ( currentTag == type ) {
361  int id = * (int*)acl_get_qualifier( entry );
362  const QString entryName = type == ACL_USER? getUserName( id ): getGroupName( id );
363  if ( entryName == name ) {
364  // found him, update
365  permissionsToEntry( entry, permissions );
366  found = true;
367  break;
368  }
369  }
370  ret = acl_get_entry( newACL, ACL_NEXT_ENTRY, &entry );
371  }
372  if ( !found ) {
373  acl_create_entry( &newACL, &entry );
374  acl_set_tag_type( entry, type );
375  int id = type == ACL_USER? getUidForName( name ): getGidForName( name );
376  if ( id == -1 || acl_set_qualifier( entry, &id ) != 0 ) {
377  acl_delete_entry( newACL, entry );
378  allIsWell = false;
379  } else {
380  permissionsToEntry( entry, permissions );
381  createdNewEntry = true;
382  }
383  }
384  if ( allIsWell && createdNewEntry ) {
385  // 23.1.1 of 1003.1e states that as soon as there is a named user or
386  // named group entry, there needs to be a mask entry as well, so add
387  // one, if the user hasn't explicitly set one.
388  if ( entryForTag( newACL, ACL_MASK ) == 0 ) {
389  acl_calc_mask( &newACL );
390  }
391  }
392 
393  if ( !allIsWell || acl_valid( newACL ) != 0 ) {
394  acl_free( newACL );
395  allIsWell = false;
396  } else {
397  acl_free( m_acl );
398  m_acl = newACL;
399  }
400  return allIsWell;
401 }
402 #endif
403 
404 bool KACL::setNamedUserPermissions( const QString& name, unsigned short permissions )
405 {
406 #ifdef HAVE_POSIX_ACL
407  return d->setNamedUserOrGroupPermissions( name, permissions, ACL_USER );
408 #else
409  Q_UNUSED( name );
410  Q_UNUSED( permissions );
411  return true;
412 #endif
413 }
414 
415 ACLUserPermissionsList KACL::allUserPermissions() const
416 {
417  ACLUserPermissionsList list;
418 #ifdef HAVE_POSIX_ACL
419  acl_entry_t entry;
420  uid_t id;
421  int ret = acl_get_entry( d->m_acl, ACL_FIRST_ENTRY, &entry );
422  while ( ret == 1 ) {
423  acl_tag_t currentTag;
424  acl_get_tag_type( entry, &currentTag );
425  if ( currentTag == ACL_USER ) {
426  id = *( (uid_t*) acl_get_qualifier( entry ) );
427  QString name = d->getUserName( id );
428  unsigned short permissions = entryToPermissions( entry );
429  ACLUserPermissions pair = qMakePair( name, permissions );
430  list.append( pair );
431  }
432  ret = acl_get_entry( d->m_acl, ACL_NEXT_ENTRY, &entry );
433  }
434 #endif
435  return list;
436 }
437 
438 #ifdef HAVE_POSIX_ACL
439 bool KACL::KACLPrivate::setAllUsersOrGroups( const QList< QPair<QString, unsigned short> > &list, acl_tag_t type )
440 {
441  bool allIsWell = true;
442  bool atLeastOneUserOrGroup = false;
443 
444  // make working copy, in case something goes wrong
445  acl_t newACL = acl_dup( m_acl );
446  acl_entry_t entry;
447 
448 //printACL( newACL, "Before cleaning: " );
449  // clear user entries
450  int ret = acl_get_entry( newACL, ACL_FIRST_ENTRY, &entry );
451  while ( ret == 1 ) {
452  acl_tag_t currentTag;
453  acl_get_tag_type( entry, &currentTag );
454  if ( currentTag == type ) {
455  acl_delete_entry( newACL, entry );
456  // we have to start from the beginning, the iterator is
457  // invalidated, on deletion
458  ret = acl_get_entry( newACL, ACL_FIRST_ENTRY, &entry );
459  } else {
460  ret = acl_get_entry( newACL, ACL_NEXT_ENTRY, &entry );
461  }
462  }
463 //printACL( newACL, "After cleaning out entries: " );
464 
465  // now add the entries from the list
466  QList< QPair<QString, unsigned short> >::const_iterator it = list.constBegin();
467  while ( it != list.constEnd() ) {
468  acl_create_entry( &newACL, &entry );
469  acl_set_tag_type( entry, type );
470  int id = type == ACL_USER? getUidForName( (*it).first):getGidForName( (*it).first );
471  if ( id == -1 || acl_set_qualifier( entry, &id ) != 0 ) {
472  // user or group doesn't exist => error
473  acl_delete_entry( newACL, entry );
474  allIsWell = false;
475  break;
476  } else {
477  permissionsToEntry( entry, (*it).second );
478  atLeastOneUserOrGroup = true;
479  }
480  ++it;
481  }
482 //printACL( newACL, "After adding entries: " );
483  if ( allIsWell && atLeastOneUserOrGroup ) {
484  // 23.1.1 of 1003.1e states that as soon as there is a named user or
485  // named group entry, there needs to be a mask entry as well, so add
486  // one, if the user hasn't explicitly set one.
487  if ( entryForTag( newACL, ACL_MASK ) == 0 ) {
488  acl_calc_mask( &newACL );
489  }
490  }
491  if ( allIsWell && ( acl_valid( newACL ) == 0 ) ) {
492  acl_free( m_acl );
493  m_acl = newACL;
494  } else {
495  acl_free( newACL );
496  }
497  return allIsWell;
498 }
499 #endif
500 
501 bool KACL::setAllUserPermissions( const ACLUserPermissionsList &users )
502 {
503 #ifdef HAVE_POSIX_ACL
504  return d->setAllUsersOrGroups( users, ACL_USER );
505 #else
506  Q_UNUSED( users );
507  return true;
508 #endif
509 }
510 
511 
512 /**************************
513  * Deal with named groups *
514  **************************/
515 
516 unsigned short KACL::namedGroupPermissions( const QString& name, bool *exists ) const
517 {
518  *exists = false;
519 #ifdef HAVE_POSIX_ACL
520  acl_entry_t entry;
521  gid_t id;
522  int ret = acl_get_entry( d->m_acl, ACL_FIRST_ENTRY, &entry );
523  while ( ret == 1 ) {
524  acl_tag_t currentTag;
525  acl_get_tag_type( entry, &currentTag );
526  if ( currentTag == ACL_GROUP ) {
527  id = *( (gid_t*) acl_get_qualifier( entry ) );
528  if ( d->getGroupName( id ) == name ) {
529  *exists = true;
530  return entryToPermissions( entry );
531  }
532  }
533  ret = acl_get_entry( d->m_acl, ACL_NEXT_ENTRY, &entry );
534  }
535 #else
536  Q_UNUSED( name );
537 #endif
538  return 0;
539 }
540 
541 bool KACL::setNamedGroupPermissions( const QString& name, unsigned short permissions )
542 {
543 #ifdef HAVE_POSIX_ACL
544  return d->setNamedUserOrGroupPermissions( name, permissions, ACL_GROUP );
545 #else
546  Q_UNUSED( name );
547  Q_UNUSED( permissions );
548  return true;
549 #endif
550 }
551 
552 
553 ACLGroupPermissionsList KACL::allGroupPermissions() const
554 {
555  ACLGroupPermissionsList list;
556 #ifdef HAVE_POSIX_ACL
557  acl_entry_t entry;
558  gid_t id;
559  int ret = acl_get_entry( d->m_acl, ACL_FIRST_ENTRY, &entry );
560  while ( ret == 1 ) {
561  acl_tag_t currentTag;
562  acl_get_tag_type( entry, &currentTag );
563  if ( currentTag == ACL_GROUP ) {
564  id = *( (gid_t*) acl_get_qualifier( entry ) );
565  QString name = d->getGroupName( id );
566  unsigned short permissions = entryToPermissions( entry );
567  ACLGroupPermissions pair = qMakePair( name, permissions );
568  list.append( pair );
569  }
570  ret = acl_get_entry( d->m_acl, ACL_NEXT_ENTRY, &entry );
571  }
572 #endif
573  return list;
574 }
575 
576 bool KACL::setAllGroupPermissions( const ACLGroupPermissionsList &groups )
577 {
578 #ifdef HAVE_POSIX_ACL
579  return d->setAllUsersOrGroups( groups, ACL_GROUP );
580 #else
581  Q_UNUSED( groups );
582  return true;
583 #endif
584 }
585 
586 /**************************
587  * from and to string *
588  **************************/
589 
590 bool KACL::setACL( const QString &aclStr )
591 {
592  bool ret = false;
593 #ifdef HAVE_POSIX_ACL
594  acl_t temp = acl_from_text( aclStr.toLatin1() );
595  if ( acl_valid( temp ) != 0 ) {
596  // TODO errno is set, what to do with it here?
597  acl_free( temp );
598  } else {
599  if ( d->m_acl )
600  acl_free( d->m_acl );
601  d->m_acl = temp;
602  ret = true;
603  }
604 #else
605  Q_UNUSED( aclStr );
606 #endif
607  return ret;
608 }
609 
610 QString KACL::asString() const
611 {
612 #ifdef HAVE_POSIX_ACL
613  ssize_t size = 0;
614  char* txt = acl_to_text(d->m_acl, &size);
615  const QString ret = QString::fromLatin1(txt, size);
616  acl_free(txt);
617  return ret;
618 #else
619  return QString();
620 #endif
621 }
622 
623 
624 // helpers
625 
626 #ifdef HAVE_POSIX_ACL
627 QString KACL::KACLPrivate::getUserName( uid_t uid ) const
628 {
629  if ( !m_usercache.contains( uid ) ) {
630  struct passwd *user = getpwuid( uid );
631  if ( user ) {
632  m_usercache.insert( uid, QString::fromLatin1(user->pw_name) );
633  }
634  else
635  return QString::number( uid );
636  }
637  return m_usercache[uid];
638 }
639 
640 
641 QString KACL::KACLPrivate::getGroupName( gid_t gid ) const
642 {
643  if ( !m_groupcache.contains( gid ) ) {
644  struct group *grp = getgrgid( gid );
645  if ( grp ) {
646  m_groupcache.insert( gid, QString::fromLatin1(grp->gr_name) );
647  }
648  else
649  return QString::number( gid );
650  }
651  return m_groupcache[gid];
652 }
653 #endif
654 
655 void KACL::virtual_hook( int, void* )
656 { /*BASE::virtual_hook( id, data );*/ }
657 
658 QDataStream & operator<< ( QDataStream & s, const KACL & a )
659 {
660  s << a.asString();
661  return s;
662 }
663 
664 QDataStream & operator>> ( QDataStream & s, KACL & a )
665 {
666  QString str;
667  s >> str;
668  a.setACL( str );
669  return s;
670 }
671 
672 // vim:set ts=8 sw=4:
KACL::namedGroupPermissions
unsigned short namedGroupPermissions(const QString &name, bool *exists) const
Access to the permissions entry for a named group, if such an entry exists.
Definition: kacl.cpp:516
kdebug.h
KACL::basePermissions
mode_t basePermissions() const
Definition: kacl.cpp:264
KACL::setOwnerPermissions
bool setOwnerPermissions(unsigned short)
Set the owner's permissions entry.
Definition: kacl.cpp:216
KACL::ownerPermissions
unsigned short ownerPermissions() const
The standard (non-extended) part of an ACL.
Definition: kacl.cpp:207
group
KACL::setAllUserPermissions
bool setAllUserPermissions(const ACLUserPermissionsList &list)
Replace the list of all user permissions with list.
Definition: kacl.cpp:501
KACL::allGroupPermissions
ACLGroupPermissionsList allGroupPermissions() const
Returns the list of all group permission entries.
Definition: kacl.cpp:553
KACL::operator==
bool operator==(const KACL &rhs) const
Definition: kacl.cpp:106
QString
QHash< uid_t, QString >
KACL::isValid
bool isValid() const
Returns whether the KACL object represents a valid acl.
Definition: kacl.cpp:120
kDebug
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
operator>>
QDataStream & operator>>(QDataStream &s, KACL &a)
Definition: kacl.cpp:664
KACL::operator!=
bool operator!=(const KACL &rhs) const
Definition: kacl.cpp:115
KACL::namedUserPermissions
unsigned short namedUserPermissions(const QString &name, bool *exists) const
Access to the permissions entry for a named user, if such an entry exists.
Definition: kacl.cpp:322
KACL::~KACL
virtual ~KACL()
Definition: kacl.cpp:94
kacl.h
KACL::setNamedGroupPermissions
bool setNamedGroupPermissions(const QString &name, unsigned short)
Set the permissions for a group with the name name.
Definition: kacl.cpp:541
KACL::operator=
KACL & operator=(const KACL &rhs)
Definition: kacl.cpp:99
KACL::KACL
KACL()
Creates an empty KACL.
Definition: kacl.cpp:83
KACL::virtual_hook
virtual void virtual_hook(int id, void *data)
Definition: kacl.cpp:655
KACL::isExtended
bool isExtended() const
The interface to the extended ACL.
Definition: kacl.cpp:131
KACL::owningGroupPermissions
unsigned short owningGroupPermissions() const
Definition: kacl.cpp:226
KACL::maskPermissions
unsigned short maskPermissions(bool &exists) const
Return the entry for the permissions mask if there is one and sets exists to true.
Definition: kacl.cpp:281
KACL::setNamedUserPermissions
bool setNamedUserPermissions(const QString &name, unsigned short)
Set the permissions for a user with the name name.
Definition: kacl.cpp:404
KACL::setOthersPermissions
bool setOthersPermissions(unsigned short)
Set the permissions entry for others.
Definition: kacl.cpp:254
KACL
The KACL class encapsulates a POSIX Access Control List.
Definition: kacl.h:47
KACL::othersPermissions
unsigned short othersPermissions() const
Definition: kacl.cpp:245
KACL::setMaskPermissions
bool setMaskPermissions(unsigned short)
Set the permissions mask for the ACL.
Definition: kacl.cpp:309
KACL::allUserPermissions
ACLUserPermissionsList allUserPermissions() const
Returns the list of all group permission entries.
Definition: kacl.cpp:415
KACL::asString
QString asString() const
Return a string representation of the ACL.
Definition: kacl.cpp:610
KACL::setOwningGroupPermissions
bool setOwningGroupPermissions(unsigned short)
Set the owning group's permissions entry.
Definition: kacl.cpp:235
QPair
operator<<
QDataStream & operator<<(QDataStream &s, const KACL &a)
Definition: kacl.cpp:658
KACL::setACL
bool setACL(const QString &aclStr)
Sets the whole list from a string.
Definition: kacl.cpp:590
KACL::setAllGroupPermissions
bool setAllGroupPermissions(const ACLGroupPermissionsList &)
Replace the list of all user permissions with list.
Definition: kacl.cpp:576
QList
KIO::number
QString number(KIO::filesize_t size)
Converts a size to a string representation Not unlike QString::number(...)
Definition: global.cpp:63
KRecentDirs::list
QStringList list(const QString &fileClass)
Returns a list of directories associated with this file-class.
Definition: krecentdirs.cpp:60
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:02 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIO

Skip menu "KIO"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal