linuxmuster / sophomorix4

sophomorix for Samba 4
GNU General Public License v3.0
7 stars 7 forks source link

sophomorixMembers empty for some groups #132

Closed kiarn closed 3 years ago

kiarn commented 3 years ago

Hello,

Some member keys, e.g. sophomorixMemberGroups or sophomorixMembers, are empty in a sophomorix-query Request for a group printer, even if the specified group has member groups :

$ sophomorix-query --group-members --group-full --sam drucker1 -j                          
{
   "GROUP" : {
      "drucker1" : {
         "sophomorixAdminGroups" : [],
         "sophomorixMembers" : [],
         "cn" : "drucker1",
         "mail" : "drucker1@unpeud.info",
         "sophomorixStatus" : "P",
         "sophomorixCreationDate" : "20210420214945.0Z",
         "sophomorixAdmins" : [],
         "sophomorixAddQuota" : [
            "---"
         ],
         "gidNumber" : null,
         "sAMAccountName" : "drucker1",
         "sophomorixType" : "printer",
         "sophomorixMailList" : "FALSE",
         "description" : "Host group for DRUCKER1$",
         "DN" : "CN=drucker1,OU=printer-groups,OU=Devices,OU=default-school,OU=SCHOOLS,DC=domain,DC=net",
         "sophomorixMemberGroups" : [],
.....
   },
   "LISTS" : {
      "ROOM" : [],
      "MEMBERLIST" : {
         "drucker1" : [
            "10a",
            "kiar"
         ]
      },
      "GROUP" : [
         "drucker1"
      ],
      "COMPUTER" : [],
      "USER" : []
   }
}

As you can see, the member kiar and the group 10a do not appear in the GROUP hash and that's the reason why the group details for a printer in the Webui are incomplete.

Thanks !

jeffbeck commented 3 years ago

Users and groups are added to printergroups as a simple membership (like samba-tool group addmembers, no extra sophomorix functionality to separate gruup admins and members).

so sophomorixMembers in GROUP is empty

You find the members of the group in the MEMBERS part of the hash, which you cut out in the ....... part

kiarn commented 3 years ago

Ok, thanks, I wasn't aware that MEMBERLIST and GROUP/sophomorixMembers was 2 different things, so I have to code a separate handler for it in the webui.

kiarn commented 3 years ago

I reopen this issue because I still have a problem with this. I get the memberlist within the MEMBERS key, ok, but user and groups are mixed in this outpute, and I have to separate user from groups :

  "MEMBERS" : {
      "drucker1" : {
         "kiar" : {
            "sophomorixAdminClass" : "teachers",
            "sophomorixRole" : "teacher",
            "objectClass" : [
               "top",
               "person",
               "organizationalPerson",
               "user"
            ],
            "givenName" : "Arnaud",
            "memberOf" : [
               "CN=role-teacher,OU=Groups,OU=GLOBAL,DC=unpeud,DC=info",
               "CN=teachers,OU=Teachers,OU=default-school,OU=SCHOOLS,DC=unpeud,DC=info",
               "CN=internet,OU=Management,OU=default-school,OU=SCHOOLS,DC=unpeud,DC=info",
               "CN=wifi,OU=Management,OU=default-school,OU=SCHOOLS,DC=unpeud,DC=info",
               "CN=webfilter,OU=Management,OU=default-school,OU=SCHOOLS,DC=unpeud,DC=info",
               "CN=intranet,OU=Management,OU=default-school,OU=SCHOOLS,DC=unpeud,DC=info",
               "CN=printing,OU=Management,OU=default-school,OU=SCHOOLS,DC=unpeud,DC=info",
               "CN=p_test,OU=Projects,OU=default-school,OU=SCHOOLS,DC=unpeud,DC=info",
               "CN=10b,OU=10b,OU=Students,OU=default-school,OU=SCHOOLS,DC=unpeud,DC=info",
               "CN=drucker1,OU=printer-groups,OU=Devices,OU=default-school,OU=SCHOOLS,DC=unpeud,DC=info"
            ],
            "sophomorixQuota" : [
               "linuxmuster-global:---:---:new:---:",
               "default-school:---:---:new:---:"
            ],
            "sn" : "Kientz",
            "DN" : "CN=kiar,OU=Teachers,OU=default-school,OU=SCHOOLS,DC=unpeud,DC=info",
            "sAMAccountName" : "kiar"
         },
         "12a" : {
            "givenName" : null,
            "objectClass" : [
               "top",
               "group"
            ],
            "sAMAccountName" : "12a",
            "memberOf" : [
               "CN=students,OU=Students,OU=default-school,OU=SCHOOLS,DC=unpeud,DC=info",
               "CN=drucker1,OU=printer-groups,OU=Devices,OU=default-school,OU=SCHOOLS,DC=unpeud,DC=info"
            ],
            "sophomorixQuota" : [
               "linuxmuster-global:---:---:",
               "default-school:---:---:"
            ],
            "sn" : null,
            "DN" : "CN=12a,OU=12a,OU=Students,OU=default-school,OU=SCHOOLS,DC=unpeud,DC=info",
            "sophomorixAdminClass" : null,
            "sophomorixRole" : null
         }
      }
   },

In order to differenciate a group, is it sufficient to test if sophomorixRole ( or sophomorixAdminClass ) is null ?

jeffbeck commented 3 years ago

Yes users have a sophomorixRole groups have a sophomorixType