Bug 95366

Summary: KUser Default LDAP Template
Product: [Unmaintained] kuser Reporter: Steven Aiello <SAiello>
Component: generalAssignee: Szombathelyi György <gyurco>
Status: RESOLVED UNMAINTAINED    
Severity: wishlist    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: RedHat Enterprise Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Steven Aiello 2004-12-17 21:23:59 UTC
Version:           KUser 2.0 Using KDE 3.3.1-4.1.rhel3.kde (using KDE KDE 3.3.1)
Installed from:    RedHat RPMs

Would it be possible to modify what tempate (for lack of a better word) KUser uses when creating an user account in LDAP ? Sort of like configuring when KAddressBook to use LDAP, and being able to map the addressbook fields to LDAP entry fields.

I am using a setup that makes use of more objectClasses then what KUser creates for an LDAP entry. I did not find this to be a big deal, Just figured I would write a script to tweak each LDAP user entry to my format after creating the account using KUser. The problem with that is after changing the LDAP entry and adding more objectClasses, I can not edit the user with KUser. It will give me an error, I think because it is only writing back the fields the 'LDAP Template' defines.

Also, it would be nice to be able to add more 'fields' to the User/Group Creation/Editing form, and then map them to LDAP entry fields.

The use of Variables would be nice, when mapping GUI form entries to LDAP fields (i.e. when configuring KUser, you can set the 'Home path template' field to use %U)
Comment 1 Szombathelyi György 2005-07-20 22:42:04 UTC
SVN commit 437061 by gyurco:

Handle additional objectclasses in the ldap user database, where we're not doing anything with these objectclasses, but leave them alone on a modify operation.
CCBUG: 95366


 M  +1 -1      TODO  
 M  +31 -3     kuserldap.cpp  
 M  +2 -3      kuserldap.h  


--- trunk/KDE/kdeadmin/kuser/TODO #437060:437061
@@ -1,7 +1,7 @@
 Must do soon (these are very easy):
 - Implement UID->SID like in ldapsam (Requires introducing the algorithmic RID base). - Ready
 - Newer samba schema support (new attributes in sambaSamAccount in Samba>=3.0.6). - Ready
-- Support LDAP entries with more objectclasses than we handle (part of #95366).
+- Support LDAP entries with more objectclasses than we handle (part of #95366). - Ready for users (lazy to do for groups)
 
 Other:
 - Add Kerberos support - Native kerberos protocols or LDAP backed?
--- trunk/KDE/kdeadmin/kuser/kuserldap.cpp #437060:437061
@@ -115,6 +115,11 @@
             mUser->setCaps( mUser->getCaps() | KUser::Cap_POSIX );
           else if ( val.lower() == "sambasamaccount" )
             mUser->setCaps( mUser->getCaps() | KUser::Cap_Samba );
+	  else if ( val.lower() != "inetorgperson" &&
+	            val.lower() != "shadowaccount" &&
+                    val.lower() != "account" )
+            mOc.append( val );
+          
         } else if ( name == "uidnumber" )
           mUser->setUID( val.toLong() );
         else if ( name == "gidnumber" )
@@ -197,10 +202,16 @@
           schemaversion = 1; 
         break;
       case KABC::LDIF::EndEntry: {
-        KUser newUser;
+        KUser emptyUser, *newUser;
         kdDebug() << "new user: " << mUser->getName() << endl;
-        mUsers.append( new KUser( mUser ) );
-        mUser->copy( &newUser );
+        newUser = new KUser( mUser );
+        mUsers.append( newUser );
+        if ( !mOc.isEmpty() ) {
+          mObjectClasses.insert( newUser, mOc );
+          kdDebug() << "user: " << newUser->getName() << " other objectclasses: " << mOc.join(",") << endl;
+        }
+        mOc.clear();
+        mUser->copy( &emptyUser );
         mUser->setDisabled( true );
 
         if ( ( mUsers.count() & 7 ) == 7 ) {
@@ -220,6 +231,8 @@
 bool KUserLDAP::reload()
 {
   kdDebug() << "kuserldap::reload()" << endl;
+  mObjectClasses.clear();
+  mOc.clear();
   mUser = new KUser();
   mUser->setPwd( "" );
   mUser->setSPwd( "" );
@@ -401,6 +414,17 @@
   if ( ( caps & Cap_Samba ) && ( user->getCaps() & KUser::Cap_Samba ) ) {
     ldif += "objectClass: sambaSamAccount\n";
   }
+  if ( mod && mObjectClasses.contains( mUser ) ) {
+    QStringList ocs = mObjectClasses[ mUser ];
+    kdDebug() << user->getName() << " has additional objectclasses: " << ocs.join(",") << endl;
+    QValueListIterator<QString> it;
+    for ( it = ocs.begin(); it != ocs.end(); ++it ) {
+      ldif += "objectClass: ";
+      ldif += (*it).utf8();
+      ldif += "\n";
+    }
+  }
+
   if ( mod ) ldif += "-\nreplace: cn\n";
   ldif += KABC::LDIF::assembleLine( "cn", cn )+"\n";
   if ( caps & Cap_InetOrg ) {
@@ -604,6 +628,10 @@
   if ( mDelUser ) {
     kdDebug() << "delete ok for: " << mDelUser->getName() << endl;
     mDelSucc.append( mDelUser );
+    if ( mObjectClasses.contains( mDelUser ) ) {
+      kdDebug() << "deleting additonal objectclasses!" << endl;
+      mObjectClasses.remove( mDelUser );
+    }
     mDel.remove();
     mDelUser = 0;
   }
--- trunk/KDE/kdeadmin/kuser/kuserldap.h #437060:437061
@@ -54,15 +54,14 @@
   int mAdv;
   QCString ldif;
   int schemaversion;
+  QStringList mOc;
+  QMap<KUser*, QStringList> mObjectClasses;
   
   QString getRDN( KUser *user );
   void getLDIF( KUser *user, bool mod );
   void delData( KUser *user );
   
   virtual void createPassword( KUser *user, const QString &password );
-  
-  
 };
 
 #endif // _KUSER_H_
-
Comment 2 Nate Graham 2025-02-07 14:30:41 UTC
kuser no longer exists as a separate thing and hasn't for several years; it's relevant functionality now exists as the Users page in System Settings. If you experience an issue with that page, or want to request a new feature for it, feel free to open a new bugzilla ticket about the matter at https://bugs.kde.org/enter_bug.cgi?product=systemsettings&component=kcm_users.

Thanks folks!