feat(username): Detect Admin access in Windows (#2791)

* Detect Admin access in Windows

* Update username doc

* Do not run tests when elevated

* Add comment

* Try fixing tests

* use deelevate crate

* simplify cfg

* Update src/modules/username.rs

Fix rookie mistake

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>

* handle errors

* fix lockfile error

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
This commit is contained in:
Rashil Gandhi
2022-04-01 21:17:49 +05:30
committed by GitHub
parent 18ad26f98d
commit c89c13038a
4 changed files with 497 additions and 82 deletions
+8 -8
View File
@@ -3435,7 +3435,7 @@ time_range = "10:00:00-14:00:00"
The `username` module shows active user's username.
The module will be shown if any of the following conditions are met:
- The current user is root
- The current user is root/admin
- The current user isn't the same as the one that is logged in
- The user is currently connected as an SSH session
- The variable `show_always` is set to true
@@ -3450,13 +3450,13 @@ these variables, one workaround is to set one of them with a dummy value.
### Options
| Option | Default | Description |
| ------------- | ----------------------- | ------------------------------------- |
| `style_root` | `"bold red"` | The style used when the user is root. |
| `style_user` | `"bold yellow"` | The style used for non-root users. |
| `format` | `"[$user]($style) in "` | The format for the module. |
| `show_always` | `false` | Always shows the `username` module. |
| `disabled` | `false` | Disables the `username` module. |
| Option | Default | Description |
| ------------- | ----------------------- | ------------------------------------------- |
| `style_root` | `"bold red"` | The style used when the user is root/admin. |
| `style_user` | `"bold yellow"` | The style used for non-root users. |
| `format` | `"[$user]($style) in "` | The format for the module. |
| `show_always` | `false` | Always shows the `username` module. |
| `disabled` | `false` | Disables the `username` module. |
### Variables