Core\Ldap\Ad\GroupType::isAppBasicGroup
$groupType->isAppBasicGroup(): boolChecks if a group is an application group. The result is true or false.
An application group belongs to Authorization Manager, a Windows tool that keeps the roles of one application. Most directories have no application groups, so isAppBasicGroup usually returns false.
isAppBasicGroup reads the bit 0x10 of groupType. An application group whose members come from a query has the bit 0x20 instead, and isAppQueryGroup reads it.
Return value
Returns bool. true when the bit is set, and false when it is not.
Changelog
| Version | Change |
|---|---|
0.0.6 | Every Core\Ldap\Ad\GroupType method that checks a flag now starts with is, for example isGlobal() and isSecurityGroup(). The old names were system, global, domainLocal, universal, appBasic, appQuery and security. |
Examples
The examples below run with this configuration file.
# These examples use the LDAP directory server on this computer at port 16636.# `tls_ca_file` is the certificate that the server's certificate is checked against.[ldap.corp]url = "ldaps://127.0.0.1:16636"base = "DC=example,DC=test"user = "CN=Reader,OU=Company,DC=example,DC=test"password = "Novis-reader-1"tls_ca_file = "../../../../../tests/db/ca.crt"timeout = "5s"
# The program may open the `corp` directory.[capabilities.ldap]connect = ["corp"]An ordinary group
<?nvs// Shows that `isAppBasicGroup` returns `false` for an ordinary group.// requires: samba-ad
var $corp = Core\Ldap::connect('corp');var $type = $corp->read('CN=Employees,OU=Company,DC=example,DC=test', { select: ['groupType'] })?->groupType();
if ($type != null) { // This prints `appBasic: false`. echo 'appBasic: ', $type->isAppBasicGroup() ? 'true' : 'false', "\n";}appBasic: falseSet on a copy
<?nvs// Shows `isAppBasicGroup` on a copy of a group type that has the flag set.// requires: samba-ad
var $corp = Core\Ldap::connect('corp');var $type = $corp->read('CN=Newsletter,OU=Company,DC=example,DC=test', { select: ['groupType'] })?->groupType();
if ($type != null) { // The group type of `Newsletter` is `2`. `with` returns a copy with the flag `0x10` added. var $app = $type->with({ appBasic: true });
// This prints `appBasic: true` and then `18`. echo 'appBasic: ', $app->isAppBasicGroup() ? 'true' : 'false', "\n"; echo $app->bits(), "\n";}appBasic: true18Count application groups
<?nvs// Shows how to count the application groups that a search finds.// requires: samba-ad
var $corp = Core\Ldap::connect('corp');var $found = $corp->search( Core\Ldap\Filter::equals('objectClass', 'group'), { base: 'OU=Company,DC=example,DC=test', select: ['groupType'] },);
uint $count = 0;foreach ($found as Core\Ldap\Entry $group) { var $type = $group->groupType(); if ($type != null && $type->isAppBasicGroup()) { $count = $count + 1; }}
// This directory has no application groups, so this prints `0`.echo $count, "\n";0