Adldap\Utilities::binarySidToString PHP Method

binarySidToString() public static method

Convert a binary SID to a string SID.
public static binarySidToString ( string $binSid ) : string
$binSid string A Binary SID
return string
    public static function binarySidToString($binSid)
    {
        $sidHex = unpack('H*hex', $binSid)['hex'];
        $subAuths = unpack('H2/H2/n/N/V*', $binSid);
        $revLevel = hexdec(substr($sidHex, 0, 2));
        $authIdent = hexdec(substr($sidHex, 4, 12));
        return 'S-' . $revLevel . '-' . $authIdent . '-' . implode('-', $subAuths);
    }

Usage Example

Esempio n. 1
0
 /**
  * Returns the model's SID.
  *
  * @return string
  */
 public function getSid()
 {
     return Utilities::binarySidToString($this->getFirstAttribute($this->schema->objectSid()));
 }