Commit Graph

48 Commits

Author SHA1 Message Date
Mia
0211066723
Add offline messaging (#8440) 2023-11-04 14:45:18 -05:00
Annika
cf483fd8a1
Room permissions: Allow control over broadcasting
This does 2 things:
* allows command permissions to be set to the default user group, granting the permission to all users
* lets rooms set permissions for broadcasting on a per-command basis by using `!` as the prefix for a command with no other permissions requirements

This is intended to let Tech & Code room let regular users broadcast `!code`, but potentially has other applications.

Closes #9534
2023-06-05 16:41:34 -07:00
Mia
a351f2b1ed Permalocks: Sanitize newlines in context 2023-05-21 16:32:42 -05:00
Mia
1273a3817c User-groups: Stop hardcoding admin symbols 2023-01-06 11:43:48 -06:00
Annika
84fd45445c Promotions: Get exact user\nthis should fix the bugs around promoting alts 2022-12-01 23:31:42 -05:00
Mia
bd828bcc5b Usergroups: Allow admins to use commands in private rooms without being roomauth 2021-09-10 12:21:02 -05:00
Mia
67d74f2418 Usergroups: Don't allow loading global auth with no userid 2021-08-12 15:24:16 -05:00
Mia
8083af2255 User groups: Don't delete trusted users on restart
See the comment at line 347 for details on why this bug happened.
2021-08-09 21:55:48 -05:00
HoeenHero
06228119d0 Auth: Don't accidentally reduce a Section Leader's permissions 2021-07-16 17:56:47 -04:00
Kris Johnson
40e36c8f38
Make adjustments to Section Leaders (#8387) 2021-07-16 12:51:29 -07:00
Mia
cb72f8e42d Usergroups: Block autoconfirmed & locked users from bypassing /blockpms ac 2021-07-15 15:19:03 -05:00
Annika
602c6af0af GlobalAuth: Handle multiple usergroups.csv entries
I don't know why users get two sometimes (I think it's an old bug that got fixed?) but this handles it better.
2021-05-29 16:02:55 -07:00
Guangcong Luo
74211859c9 Update to TypeScript 4.3
Changes relevant to our codebase:

- TypeScript now knows that `typeof id === 'string'`! A bunch of casts
  on `User | ID` or `Room | RoomID` are no longer necessary!!!

- `override` will protect against certain typoes, and we'll adopt it
  (and `--noImplicitOverride`) as soon as sucrase comes in

- `declare` is now required for properties we want to narrow the type
  of without directly overwriting - a good thing to use going forward,
	but very annoying to fix all our old code for
2021-05-26 14:16:54 -07:00
Kris Johnson
a1bdafbfe8
Add room sections (#8205) 2021-04-23 22:39:56 -07:00
Mia
075c9e85c5 Usergroups: Properly include aliases in supportedRoomPermissions
This can be useful for things like /poll htmlcreate
2021-04-20 12:54:25 -05:00
Mia
c9cbc8268f
Usergroups: Remove deprecated 's' permission (#7676) 2021-02-10 02:23:20 -08:00
Guangcong Luo
cb65fb868d Properly fix Auth#hasPermission 2021-01-28 22:04:03 -08:00
Annika
b92924fc8b Fix Auth#hasPermission
As per the discussion in #sim-dev:
  - Global permissions should always use User#tempGroup
  - Room permissions should check both the roomauth list and user and User#tempGroup
2021-01-28 18:42:16 -08:00
Annika
1f7ea9e990 Fix bug with permission jurisdictions
This bug allowed people to punish people of the same and higher ranks. Monkeypatched on main.
2021-01-28 13:33:23 -08:00
Mia
11e4dcd272
Support using more moderation commands offline (#7742) 2021-01-28 10:41:24 -08:00
Mia
20be102fa0
Usergroups: Fix atLeast whitelist handling (#7905)
* Usergroups: Fix atLeast whitelist handling

* Update server/user-groups.ts

Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>

Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2021-01-15 18:30:26 -08:00
Mia
b7001afdba
Chat: Add a method for iterating commands (#7722) 2020-12-03 19:37:59 -08:00
Mia
62f358f1d0
Exclude room-specific commands for other rooms in /permissions (#7679) 2020-12-01 07:07:50 -08:00
Guangcong Luo
fbdda144eb
Support Config.noguestsecurity (#7625)
This Config option, intended purely for development test servers,
allows users to log in without a signed token, by using
`/trn [USERNAME]`. This allows logins without a login server.

The rest of the server has been changed to make sure unregistered
users never have any powers they shouldn't have.
2020-11-05 04:55:05 -08:00
Konrad Borowski
da24ba9c6e
Consider bots to be staff (#7633) 2020-11-04 05:21:46 -08:00
Mia
c0baf2135d
Make /addline broadcastable and rename to /pline (#7621) 2020-11-02 08:47:55 -08:00
Guangcong Luo
9d87616176
Add more style linting rules (#7537)
* Lint arrow-body-style

* Lint prefer-object-spread

Object spread is faster _and_ more readable.

This also fixes a few unnecessary object clones.

* Enable no-parameter-properties

This isn't currently used, but this makes clear that it shouldn't be.

* Refactor more Promises to async/await

* Remove unnecessary code from getDataMoveHTML etc

* Lint prefer-string-starts-ends-with

* Stop using no-undef

According to the typescript-eslint FAQ, this is redundant with
TypeScript, and they're not wrong. This will save us from needing to
specify globals in two different places which will be nice.
2020-10-19 02:42:28 -07:00
Mia
92b77cc459
User groups: Autojoin staff rooms on global promo (#7500) 2020-10-09 16:04:06 -07:00
Annika
3b3bbd583d Add 'roomprizewinner' to the room permissions list
This will allow `/permissions` to set the required rank to promote to Prize Winner, just as with other room groups.
2020-09-27 16:35:09 -07:00
Mia
b9df40c5af
Auth: Fix whitelist/prizewinner giving trusted status (#7418) 2020-09-25 08:58:31 -07:00
whalemer
f5bdef7b4b
Auth: Fix changing a group's permission for commands (#7323) 2020-09-06 12:29:22 -07:00
Mia
4f3c5c8581
Permissions: Support setting permissions for all sub-commands at once (#7164) 2020-09-05 17:40:11 -07:00
Guangcong Luo
e14485656f Implement a basic /hiderank
This doesn't really have any nice-to-have automatic restoration
features but it should be all the important parts.

`user.group` no longer exists, and has been replaced with
`user.tempGroup`, which now applies both to temporary promotions of
unregistered users, as well as temporary hidden ranks of auth.
2020-08-22 07:20:26 -07:00
Guangcong Luo
2878793964 Revert accidental merge of /hiderank code
`/hiderank` code was accidentally merged into #7078

This fully backs out its code.
2020-08-22 06:57:24 -07:00
Annika
1fa74d9868
Fix Auth#isAuthLevel (#7174)
Also prevents setting mod(chat|join) below regular user.
2020-08-07 11:05:18 -07:00
Annika
8287cbc7fb
Remove User#authAtLeast and add more sysop bypasses (#7046) 2020-08-06 00:12:30 -07:00
Mia
47d00bf912
Support per-command permissions for sub-commands (#7142) 2020-08-04 03:01:17 -07:00
Annika
cd85cd7a9d
Hosts & IPTools: Refactor to remove hardcoded ranges (#7078) 2020-07-29 23:04:50 -07:00
Guangcong Luo
fe2eb27860
Refactor ip and modchat permissions (#7076)
- `ip` and `ipself` are now separate permissions. This means that `ip`
  is now a generalized permission for viewing IPs (no more need to use
  `globalban`, since `ipself` now controls the ability to see your own
  IP address)

- `alts` and `altsself` are now also separate (all users used to be
  able to `altsself`).

- `modchat`, `modchatall`, and `manageroom` are now just one `modchat`
  permission whose jurisdiction controls how high you can set modchat.
2020-07-29 00:38:52 -07:00
Mia
94fff9d496
Support customizing permissions per-room (#6883) 2020-07-29 00:22:03 -07:00
Guangcong Luo
52f0096c30 Refactor Auth.hasPermission
Half the permissions checks were previously in `user.can`, which is
unintuitive. It's now completely self-contained and should be pretty
readable, now, with `getEffectiveSymbol` and `hasJurisdiction` as
separate functions.
2020-07-13 00:55:23 -07:00
Guangcong Luo
d7ba455e2b Update permissions
Permissions have gotten out-of-date, so this commit syncs them.
Default permissions are now matched with Main, in particular including
the new & rank as admin (removing the old Leader rank and ~ symbol).

Relevant changes:
- Admin (~) and Leader (&) have been merged into Admin (&)
- The 'ban' permission was split into 'globalban' and 'ban'
- The 'broadcast' permission was renamed 'show' (going forward,
  "broadcast" should only refer to the big red/blue/green
  announcement bars.)
- Bots no longer have global moderation abilities, making it
  easier to give untrustworthy bots the "bot" rank.
2020-07-03 17:32:49 -04:00
Guangcong Luo
6af875af8b Improve RoomPermission/GlobalPermission checks
Global permissions can no longer be used as room permissions. Instead,
the two are entirely separate lists, with only a few permissions in
both lists.
2020-06-21 03:53:06 -07:00
Guangcong Luo
ee6e43b552 Strongly type RoomPermission and GlobalPermission
`user-groups.ts` now tracks the list of possible values for
`RoomPermission` and `GlobalPermission` in a const.
2020-06-21 01:43:27 -07:00
Guangcong Luo
140f4ad936 Support /forceroompromote
Previously, forcepromotes were done with a !!! sigil, which was
kind of silly. They now use a command starting with "force", as
is standard.
2020-06-10 11:23:20 -04:00
Guangcong Luo
8c4d55b184 Fix bugs in Settings refactor 2020-06-09 15:40:54 -04:00
Guangcong Luo
c444036f85 Support whitelisting users
(Whitelist is being implemented as a hardcoded custom group.)
2020-06-09 08:22:44 -07:00
Mia
15fed24b40
Refactor auth and room.settings (#6777)
This implements two big changes:

- All settings shared between `room.chatRoomData` and `room` have been
  merged into `room.settings` (so, for instance, `room.slowchat` is now
  only `room.settings.slowchat`).

  This makes it so we never have to worry about them getting "out of
  sync".

  - Checking to see if a room is persistent is now `if (room.persist)`
    instead of `if (room.chatRoomData)`

  - `Rooms.global.writeChatRoomData()` is now rarely called directly;
    there's a new `room.saveSettings()` which will handle it for you.

  - All properties of `room.settings` are now optional (except
    `title`).

- There's a new file `user-groups.ts` which handles authority.

  - `room.auth` and `Users.globalAuth` are now
    `Auth extends Map<ID, GroupSymbol>` objects.

  - `room.auth` is now always defined, removing the need for
    `room.auth?.[userid]` workarounds.

  - A lot of code relating to usergroups and permission checks have
    been refactored.

Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2020-06-09 08:22:25 -07:00