# Security

{% hint style="info" %}
We split players in 4 groups:

* Player		(new players, regular players)
* Trusted		(e. g. high level, donator)
* Staff		(Staff)
* Protected	(e.g. Admins, Owners)



If a player is in a higher group then he is also in all lower groups. Example: A protected player is also in the staff, trusted and player group.
{% endhint %}

## Functions

<details>

<summary>sWatch.isTrusted</summary>

#### Arguments

* **(Player|SteamID32|SteamID64)** Player - Player shall be online

#### Returns

1. **(Boolean)** isTrusted

#### Example

<pre class="language-lua"><code class="lang-lua">print(sWatch.isTrusted(normalUser)) // false
<strong>print(sWatch.isTrusted(trustedUser)) // true
</strong>print(sWatch.isTrusted(staffMember)) // true
print(sWatch.isTrusted(protectedUser)) // true
</code></pre>

</details>

<details>

<summary>sWatch.isStaff</summary>

Player is considered staff if his usergroup was added ingame under `Security` and `Staff and admin usergroups`

#### Arguments

* **(Player|SteamID32|SteamID64)** Player - Player shall be online

#### Returns

1. **(Boolean)** isStaff

#### Example

<pre class="language-lua"><code class="lang-lua">print(sWatch.isStaff(normalUser)) // false
<strong>print(sWatch.isStaff(trustedUser)) // false
</strong>print(sWatch.isStaff(staffMember)) // true
print(sWatch.isStaff(protectedUser)) // true
</code></pre>

</details>

<details>

<summary>sWatch.isProtected</summary>

Player is considered protected if he was whitelisted ingame under `Security`.

#### Arguments

* **(Player|SteamID32|SteamID64)** Player

#### Returns

1. **(Boolean)** isProtected

#### Example

<pre class="language-lua"><code class="lang-lua">print(sWatch.isProtected(normalUser)) // false
<strong>print(sWatch.isProtected(trustedUser)) // false
</strong>print(sWatch.isProtected(staffMember)) // false
print(sWatch.isProtected(protectedUser)) // true
</code></pre>

</details>

<details>

<summary>sWatch.getPlayerPermission</summary>

#### Arguments

* **(Player|SteamID32|SteamID64)** Player

#### Returns

1.  **(String)** GroupName&#x20;

    "Player", "Trusted", "Staff", "Proteced"
2.  **(Number)** GroupIndex

    Player = 0, Trusted = 1, Staff = 2, Protected = 3

</details>

<details>

<summary>sWatch.getHealthCheckResult</summary>

Returns a table with all passed and failed health checks. When called, all checks will get updated.

#### Returns

1. **(Table)** result

* (Number) total\_checks
* (Number) total\_impacted
* (Number) max\_score
* (Number) max\_severity
* (Color) max\_severity\_color
* (Table) passed
  * (String) id
  * (String) name
  * (String) desc
  * (String) long\_desc
  * (Number) score
  * (String) severity
  * (Table) list
  * (Color) color
* (Table) failed
  * (String) id
  * (String) name
  * (String) desc
  * (String) long\_desc
  * (Number) scor

</details>

## Hooks
