Core\Ldap\Sid::rid
$sid->rid(): intReturns the last number of the SID, the RID (relative identifier). In a domain, the RID tells the accounts apart. Some RIDs are the same in every domain: 500 is the built-in Administrator, 512 is Domain Admins and 513 is Domain Users.
Use it to find a well-known account or group, whatever its domain is.
Good to know: the RID is a number from 0 to 4294967295.
Return value
Returns int. The RID, from 0 to 4294967295.
Examples
Read the rid
<?nvs// Shows how to read the RID, the last number of a SID.
var $user = Core\Ldap\Sid::parse('S-1-5-21-1004336348-1177238915-682003330-1105');// This prints 1105.echo $user->rid(), "\n";1105Well known groups
<?nvs// Shows how to find the well-known groups in a list of group SIDs.
array<string> $groups = [ 'S-1-5-21-1004336348-1177238915-682003330-513', 'S-1-5-21-1004336348-1177238915-682003330-1120', 'S-1-5-21-1004336348-1177238915-682003330-512',];// This prints Domain Users, other and Domain Admins.foreach ($groups as string $text) { int $rid = Core\Ldap\Sid::parse($text)->rid(); if ($rid == 512) { echo "Domain Admins\n"; } elseif ($rid == 513) { echo "Domain Users\n"; } else { echo "other\n"; }}Domain UsersotherDomain AdminsLargest rid
<?nvs// Shows the largest RID a SID can have.
var $sid = Core\Ldap\Sid::parse('S-1-5-21-4294967295');// This prints 4294967295.echo $sid->rid(), "\n";4294967295