aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* | util.human.io: Pass the whole column definition to mapper functionKim Alvefur2023-04-071-1/+1
| | | | | | | | | | | | I forget why I wanted this, but it may allow doing things like pull settings from the column, especially when the mapper function is reused among many columns.
* | util.human.io: Allow defining per column ellipsis functionKim Alvefur2023-04-071-1/+1
| | | | | | | | | | | | As an alternative to doing it in the mapper function. Could be useful in cases where one may want to put the ellipsis in the middle or beginning instead of the start.
* | util.human.io: Pass expected width to mapper functionKim Alvefur2023-04-071-1/+1
| | | | | | | | | | In order to allow it to adjust its output to available space, apply its own ellipsis method or other compacting method.
* | mod_admin_shell: Dynamically size JIDs and hostsKim Alvefur2023-04-071-4/+4
| | | | | | | | Reasoning: a hostname is one part, a JID is 3 parts.
* | mod_admin_shell: More dynamic widths calculationsKim Alvefur2023-04-071-3/+14
| |
* | mod_admin_shell: Calculate widths of columns from example valuesKim Alvefur2023-04-061-12/+19
| | | | | | | | | | Harder to accidentally count wrong if Lua is doing the counting on a plausible input.
* | mod_admin_shell: Strip 'prosody:' prefix to allow narrower Role columnKim Alvefur2023-04-021-3/+4
| |
* | util.set: Change tostring format to {a, b, c}Kim Alvefur2023-04-061-1/+1
| | | | | | | | | | | | | | | | Makes it easier to make out where the set starts and ends in cases where it may get embedded and tostring()-ed in a log message. { } taken over from util.array for consistency with some other systems syntax for Sets, e.g. Python
* | util.array: Change tostring format to [a,b,c]Kim Alvefur2023-04-061-1/+1
| | | | | | | | | | | | | | Arrays in Lua do use { } but since __tostring is often user-facing it seems sensible to use [ ] instead for consistency with many other systems; as well as to allow the {a,b,c} formatting to be used by util.set without being confused with util.array.
* | util.human.io: Fix pattern to support fractional proportionsMatthew Wild2023-04-061-2/+2
| |
* | util.human.io: Support for dynamic "proportional" columnsMatthew Wild2023-04-061-4/+14
| | | | | | | | | | | | | | | | Instead of a percentage, this allows you to specify e.g. `width="[N]p"`, where a width="2p" will be twice the width of a width="1p" column. Compatibility with the old %-based widths is preserved, and percentages adding up to more than 100 are handled more gracefully.
* | mod_debug_reset: Remove now unused import of util.time (thanks luacheck)Matthew Wild2023-04-061-2/+0
| |
* | mod_debug_reset: Don't delay operations until next tickMatthew Wild2023-04-061-6/+4
| | | | | | | | | | | | | | | | For some unknown reason, this was required with the old mock util.time functions prior to 012d6e7b723a. After 012d6e7b723a, it breaks. So I'm happy to revert to not delaying anything. This makes tests pass again.
* | integration tests: Preserve unmocked time.monotonic()Matthew Wild2023-04-061-6/+5
| | | | | | | | | | | | | | | | | | | | With monotonic() frozen, timers may fail to trigger. This caused problems after the new util.startup changes that moved the server-started event to a timer. The timer wouldn't trigger, the event didn't fire, and prosody would fail to daemonize. All the tests that depend on specific time behaviour are depending on wall clock time, so only mocking util.time.now() and os.time() fixes those.
* | mod_csi: Drop summary stats, doesn't work in normal moduleKim Alvefur2023-04-061-9/+0
| | | | | | | | | | | | This method ends up going up for each collection and the :clear() method is only available to global modules (see e.g. mod_c2s), while regular per-host modules get scoped stats
* | mod_csi: Add metrics, covering changes and totalsKim Alvefur2023-04-061-0/+12
| | | | | | | | | | Motivation: Investigating clients that seem to forget to set CSI. Also, of course, MORE GRAPHS!
* | mod_tokenauth: Add API method to revoke a grant by idMatthew Wild2023-04-051-0/+7
| | | | | | | | We probably want to refactor revoke_token() to use this one in the future.
* | Merge 0.12->trunkKim Alvefur2023-04-041-1/+10
|\|
| * mod_smacks: Replace existing watchdog when starting hibernationKim Alvefur2023-04-021-0/+4
| | | | | | | | | | | | There shouldn't be one here but if there is, for some reason, it's better to close it than have it around to wake up and possibly try to destroy the session.
| * mod_smacks: Fix stray watchdog closing sessionsKim Alvefur2023-04-021-1/+6
| | | | | | | | | | | | Unsure exactly how this happens, but sometimes a watchdog appears to close a session that isn't hibernating, or hasn't hibernating long enough.
* | mod_adhoc: Remove "mod_" prefix from permission action nameKim Alvefur2023-04-022-3/+3
| | | | | | | | Other places doesn't have "mod_" there, why should it here?
* | util.fsm: New utility lib for finite state machinesMatthew Wild2022-03-172-0/+404
| |
* | util.set: Add missing remove function in Teal specKim Alvefur2023-03-311-0/+1
| |
* | net.http: Rename enum in Teal spec to avoid name clashKim Alvefur2023-03-311-2/+2
| |
* | moduleapi: Add luacheck annotation to suppress warning about unused selfMatthew Wild2023-04-011-1/+1
| | | | | | | | | | This is a convenience function, and there is currently no module-specific code required to implement it. Not using 'self' is to be expected.
* | moduleapi: Add module:once() to execute a function after module load/startupMatthew Wild2023-04-011-0/+5
| | | | | | | | | | | | | | | | | | | | It is a common pattern for modules to do something like check for prosody.start_time, and execute code immediately if it is present, or wait for the server-started event if it isn't yet. For example, this allows you to run code after all other modules/hosts have been loaded, that are going to be loaded. Such code can now be replaced with a simple call to this method.
* | util.startup: Add prosody.started promise to easily execute code after startupMatthew Wild2023-04-011-3/+14
| | | | | | | | | | | | | | | | | | To avoid a race where server-started fires before the promise function body is run (on next tick), I moved server-started to fire on the next tick, which seems sensible anyway. Errors are logged, I'm not sure if we ought to be doing something more here. I'm sure we'll find out.
* | mod_admin_shell: Allow matching on host or bare JID in c2s:showKim Alvefur2023-03-311-2/+2
| | | | | | | | | | Only supporting exact match on full JID isn't helpful if you want to list sessions per host or user.
* | mod_invites: Record roles as ordered list, first becoming primary roleKim Alvefur2023-03-301-4/+4
| | | | | | | | For mod_invites_register to apply on user creation.
* | mod_invites_register: Allow roles to be an ordered list, first being primaryKim Alvefur2023-03-301-1/+14
| | | | | | | | | | | | Part of an update to mod_invites and friends to the new authz and roles. Invites with roles in the old way will need to be migrated, but with invites often being short lived it is probably not a long-lived problem.
* | mod_tokenauth: Add API to inspect individual grants or all of a user's grantsMatthew Wild2023-03-291-0/+18
| |
* | mod_tokenauth: Move grant validation to a reusable functionMatthew Wild2023-03-291-6/+25
| |
* | sessionmanager: Preserve 'since' property of original session after resumptionMatthew Wild2023-03-291-0/+1
| |
* | util.session: Add 'since' property with timestamp of session creationMatthew Wild2023-03-291-0/+2
| |
* | mod_tokenauth: fix traceback if password has never been changedJonas Schäfer2023-03-281-1/+1
| | | | | | | | | | By checking the password_updated_at for non-nilness before using it, we avoid a nasty crash :-).
* | teal-src/README: Words on Compiling to LuaKim Alvefur2023-03-281-0/+17
| |
* | teal-src/README: Tweak markdown syntaxKim Alvefur2023-03-281-1/+3
| |
* | mod_tokenauth: Fire events on grant creation and revocationMatthew Wild2023-03-281-1/+13
| |
* | teal-src: Add a README with a few pointers to get startedKim Alvefur2023-03-281-0/+29
| |
* | teal-src: Add keyval+ store typeMatthew Wild2023-03-281-0/+1
| |
* | mod_tokenauth: Fix storage API mistake in revocationKim Alvefur2023-03-281-1/+1
| |
* | mod_tokenauth: Fix traceback when checking expiry of tokens with no expiryMatthew Wild2023-03-271-1/+2
| |
* | mod_tokenauth: Refactor API to separate tokens and grantsMatthew Wild2023-03-271-115/+92
| | | | | | | | | | | | | | This is another iteration on top of the previous sub-tokens work. Essentially, the concept of a "parent token" has been replaced with the concept of a "grant" to which all tokens now belong. The grant does not have any tokens when first created, but the create_token() call can add them.
* | mod_tokenauth: Support for creating sub-tokensMatthew Wild2023-03-261-22/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Properties of sub-tokens: - They share the same id as their parent token - Sub-tokens may not have their own sub-tokens (but may have sibling tokens) - They always have the same or shorter lifetime compared to their parent token - Revoking a parent token revokes all sub-tokens - Sub-tokens always have the same JID as the parent token - They do not have their own 'accessed' property - accessing a sub-token updates the parent token's accessed time Although this is a generic API, it is designed to at least fill the needs of OAuth2 refresh + access tokens (where the parent token is the refresh token and the sub-tokens are access tokens).
* | mod_tokenauth: return error if storage of new token failsMatthew Wild2023-03-261-1/+4
| |
* | moduleapi: Add 'peek' to :may() and new :could() helper to suppress loggingMatthew Wild2023-03-261-7/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | The current method logs scary "access denied" messages on failure - this is generally very useful when debugging access control stuff, but in some cases the call is simply a check to see if someone *could* perform an action, even if they haven't requested it yet. One example is determining whether to show the user as an admin in disco. The 'peek' parameter, if true, will suppress such logging. The :could() method is just a simple helper that can make the calling code a bit more readable (suggested by Zash).
* | moduleapi: may: Fail early if a local session has no role assignedMatthew Wild2023-03-251-3/+8
| | | | | | | | | | | | | | We expect every session to explicitly have a role assigned. Falling back to any kind of "default" role (even the user's default role) in the absence of an explicit role could open up the possibility of accidental privilege escalation.
* | core.usermanager: Correct formatting of not implemented errorKim Alvefur2023-03-262-5/+5
| | | | | | | | Spaces, no hyphen, apparently.
* | mod_admin_shell: Enable user after creation with roleKim Alvefur2023-03-261-0/+5
| | | | | | | | | | Fixes that otherwise the user was created in a disabled state and left as such.
* | mod_admin_shell: Simplify user creation when no role givenKim Alvefur2023-03-261-8/+16
| | | | | | | | | | | | Idea here is to prevent a user from being created with the default role if a different role was given, but that dance wouldn't be needed if no role is provided.