Core\Ldap\Ad\GroupType::isAppQueryGroup
$groupType->isAppQueryGroup(): boolChecks if a group is an application group whose members come from a query. The result is true or false.
This kind of group belongs to Authorization Manager, a Windows tool that keeps the roles of one application. The group has no list of members. The application runs a query each time it checks who is in the group. Most directories have no such groups, so isAppQueryGroup usually returns false.
isAppQueryGroup reads the bit 0x20 of groupType. An application group with a list of members has the bit 0x10 instead, and isAppBasicGroup 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 `isAppQueryGroup` returns `false` for an ordinary group.// requires: samba-ad
var $corp = Core\Ldap::connect('corp');var $type = $corp->read('CN=Managers,OU=Company,DC=example,DC=test', { select: ['groupType'] })?->groupType();
if ($type != null) { // This prints `appQuery: false`. echo 'appQuery: ', $type->isAppQueryGroup() ? 'true' : 'false', "\n";}appQuery: falseSet on a copy
<?nvs// Shows `isAppQueryGroup` 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=Employees,OU=Company,DC=example,DC=test', { select: ['groupType'] })?->groupType();
if ($type != null) { // `with` returns a copy with the flag `0x20` added. var $app = $type->with({ appQuery: true });
// This prints `appQuery: true` and then `-2147483614`. echo 'appQuery: ', $app->isAppQueryGroup() ? 'true' : 'false', "\n"; echo $app->bits(), "\n";}appQuery: true-2147483614Two kinds of application group
<?nvs// Shows that `isAppQueryGroup` and `isAppBasicGroup` read two different flags.// 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) { var $basic = $type->with({ appBasic: true }); var $query = $type->with({ appQuery: true });
// Each copy has only one of the two flags. // This prints `basic: true false` and then `query: false true`. echo 'basic: ', $basic->isAppBasicGroup() ? 'true' : 'false', ' ', $basic->isAppQueryGroup() ? 'true' : 'false', "\n"; echo 'query: ', $query->isAppBasicGroup() ? 'true' : 'false', ' ', $query->isAppQueryGroup() ? 'true' : 'false', "\n";}basic: true falsequery: false true