/** * Grant a User Right * * @param string $user_id * @param string $right * @return \argent_error|true */ public static function grant_right($user_id, $right) { $error = new argent_error(); $db = new argent_database(); if (!self::object_exists($user_id)) { $error->add('1013', 'Invalid user account', $user_id, 'argent_uauth'); } $right_id = self::right_exists($right); if (!$right_id) { $error->add('1042', 'Invalid user right', $right, 'argent_uauth'); } if ($error->has_errors()) { return $error; } return argent_meta::relate($user_id, $right_id, 'user_right'); }