IOPLEX
Communications Software
Plexcel for PHP - Active Directory PHP Integration
plexcel_new
plexcel_status
plexcel_find_authorities_by_domain
plexcel_get_authority
plexcel_get_domain
plexcel_log
plexcel_preamble
plexcel_authenticate
plexcel_sso
plexcel_logon
plexcel_logoff
plexcel_accept_token
plexcel_is_member_of
plexcel_set_password
plexcel_change_password
plexcel_gen_service_keytab
plexcel_search_objects
plexcel_get_account
plexcel_add_object
plexcel_modify_object
plexcel_delete_object
plexcel_set_attrdefs
plexcel_get_attrdefs
plexcel_set_conv_attrdefs

plexcel_get_attrdefs

Printer Friendly Format

Synopsis

array plexcel_get_attrdefs(resource $px, array $attrs)

Description

The plexcel_get_attrdefs function will retrieve a list of attribute definitions for the specified attribute. This function may be used by applications that require attribute intelligence such as a directory editor or to validate user input.

The $px parameter is the Plexcel context resource from which attribute definitions are being queried.

The $attrs parameter is an array of attribute names for which attribute definitions should be returned.

A Plexcel attribute definition is an array with elements type , flags and conv . The type and conv values are defined by the constants listed in for plexcel_set_attrdefs . When querying attribute definitions however, a complete list of values for the flags element is necessary. These are shown below.

Flag Description
PLEXCEL_TYPE_UNDEFINED This flag indicates that no attribute definition is set and that the default definition was returned (multivalued binary).
PLEXCEL_SINGLE_VALUED This flag indicates that the attribute is single valued.
PLEXCEL_CASE_EXACT This flag indicates that the attribute is a string that should use case sensitive behavior when compared to other strings. Currently Plexcel ignores this flag.
PLEXCEL_DN This flag indicates that the attribute is a distinguished name. Default attribute definitions set this flag for DNs but otherwise ignore it.
PLEXCEL_PROTECTED This flag indicates that the attribute is protected. Currently only the distinguishedName attribute has this flag set and is otherwise currently ignored by Plexcel.

Returns

The plexcel_get_attrdefs returns an array of zero or more attribute definitions. Otherwise, FALSE is returned in which case plexcel_status should be consulted.

Note: Because an empty array will evaluate to FALSE when tested with the == operator, it is recommended that the is_array function be used to test the return value to distinguish between an empty array and FALSE .

Example

The following PHP script prints the default attribute definitions for the displayName , servicePrincipalName and bogus attributes.

<?php
$px = plexcel_new(NULL, NULL);
$attrs = array('displayName', 'servicePrincipalName', 'bogus');

        $attrdefs = plexcel_get_attrdefs($px, $attrs);
      
if (is_array($attrdefs) == FALSE)
    die('<pre>' . plexcel_status(NULL) . '</pre>');
echo '<pre>';
print_r($attrdefs);
echo '</pre>';
?>
Examining default attribute definitions with plexcel_get_attrdefs

The above script prints the following output (minus comments added afterward).

Array
(
    [lastLogon] => Array
        (
            [type] => 6     // PLEXCEL_TYPE_INT64
            [flags] => 4    // PLEXCEL_SINGLE_VALUED
            [conv] => 0     //
        )

    [servicePrincipalName] => Array
        (
            [type] => 1     // PLEXCEL_TYPE_STRING
            [flags] => 0    //
            [conv] => 0     //
        )

    [bogus] => Array
        (
            [type] => 3     // PLEXCEL_TYPE_BINARY
            [flags] => 2    // PLEXCEL_TYPE_UNDEFINED
            [conv] => 0     //
        )

)

The plexcel_get_attrdefs example print_r output

See also

plexcel_set_attrdefs

© 2008 IOPLEX Software | Contact Us | Policies