Commit graph

38 commits

Author SHA1 Message Date
Mantas Masalskis
1e20dc5e1e Maintenance: Ensure services have a single entry point and an easy way to pass current user 2026-04-23 12:39:32 +03:00
Mantas Masalskis
aaa4700468 Maintenance: Renames 422 HTTP response code from unprocessable_entity to unprocessable_content due to RFC update 2026-04-22 18:23:21 +03:00
Mantas Masalskis
a1b9ef2bbb Maintenance: Update copyright information. 2026-01-02 15:41:09 +02:00
Mantas Masalskis
10f627cb69 Maintenance: Update copyright information 2025-01-01 17:39:43 +02:00
Dominik Klein
58da12c730 Feature: Desktop view - Implement Token Access personal setting section.
Co-authored-by: Dominik Klein <dk@zammad.com>
Co-authored-by: Mantas Masalskis <mm@zammad.com>
Co-authored-by: Dusan Vuckovic <dv@zammad.com>
2024-05-13 19:06:51 +02:00
Dominik Klein
e054d6ca79 Maintenance: Update copyright information. 2024-01-02 11:55:19 +01:00
Martin Gruner
4297cb86ba Maintenance: Add quoting for SQL LIKE bind parameters. 2023-09-09 16:20:05 +02:00
Martin Gruner
fc2491aabf Maintenance: Renamed confusing fields in the tokens table.
The Token model is used to store access tokens and had field names which may have caused confusion for developers using them. Therefore, the field previously called name: now has the correct identifier token: (as it stores the actual token value), and the field previously called label: is now called name: for better consistency with other models.
2023-04-11 12:50:56 +02:00
Mantas
3b29835d4a Fixes #3119 - Clarify authentication_check and authorize! before_actions 2023-03-21 20:14:54 +00:00
Martin Gruner
a69fc3a451 Maintenance: Force usage of 'reorder' instead of 'order'. 2023-03-06 15:05:13 +01:00
Florian Liebe
9dfc232536 Maintenance: Update copyright information. 2023-01-02 16:19:55 +01:00
Martin Gruner
218e854a4c Maintenance: Bump rubocop from 1.31.0 to 1.31.1
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.31.0 to 1.31.1.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.31.0...v1.31.1)
2022-06-30 07:38:32 +02:00
Martin Gruner
0046c509f7 Maintenance: Bump rubocop from 1.30.1 to 1.31.0
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.30.1 to 1.31.0.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.30.1...v1.31.0)
2022-06-29 13:18:52 +02:00
Martin Gruner
104e2b415e Maintenance: Improved translatable source strings. 2022-01-19 13:19:04 +01:00
Martin Gruner
24c3bdfd87 Maintenance: Update copyright header. 2022-01-01 14:38:12 +01:00
Martin Gruner
64a87b1c67 Fixes #2709, fixes #2666, fixes #2665, fixes #556, fixes #3275 - Refactoring: Implement new translation toolchain based on gettext.
- Translations are no longer fetched from the cloud.
- Instead, they are extracted from the codebase and stored in i18n/zammad.pot.
- Translations will be managed via a public Weblate instance soon.
- The translated .po files are fed to the database as before.
- It is now possible to change "translation" strings for en-us locally via the admin GUI.
- It is no longer possible to submit local changes.
2021-11-15 16:58:19 +01:00
Martin Gruner
5df98684da Maintenance: Update copyright information and add a new rubocop cop to watch over it. 2021-06-01 12:20:20 +00:00
Ryan Lue
dde7208ebc Fixes #3111 - admin.user token permission doesn't allow fetching details of specific user 2020-08-14 13:12:41 +02:00
Ryan Lue
80b330d73f Refactoring: Clarify complex Permission queries
This commit was prepared to facilitate a larger refactoring assignment
as part of the Pundit migration.

As a bonus, it includes some SQL query optimizations!

=== Why was this refactoring necessary?

It's not, strictly speaking.
But the Pundit migration involves taking complex querying logic
and moving it into Scope classes as appropriate,
and deciding where things belong is really difficult
when you can't see what they're doing.

=== So how does this refactoring fix the problem?

* It replaces raw SQL queries with Ruby-esque ActiveRecord queries.
* It replaces complex, procedural code
  that's full of loops and obscure local variable assignment
  with compact, cleanly-formatted code
  that follows Ruby idioms and uses meaningful variable names.

In my opinion, it's much faster and easier
to understand what the code does this way.

=== What kinds of SQL query optimizations are included?

* n+1 query: user_access_token#index instantiated all active permissions
  and then called current_user.permissions? on _every single one._
  A fresh installation of Zammad contains 57 permissions,
  so this was a lot of unnecessary queries.

  The method has been rewritten to make only one query instead.

* User#permissions? used to query the DB once
  for each argument it was given.
  Now, it only queries the DB once, even when given many arguments.

* We had a couple SQL queries that used both #select and #pluck.
  (When using #pluck, #select is redundant.)
  Removing #select from these calls did not improve performance,
  but it did clean up unnecessary code.
2020-07-07 13:14:58 +02:00
Ryan Lue
becbdb1baa Refactoring: Replaced home-rolled authorization logic in Controllers with Pundit. 2020-03-19 10:39:51 +01:00
Martin Edenhofer
ffd7ae99b1 Fixes issue #2530 - Not used SQL index with PostgreSQL in certain cases on very large setups. 2019-04-07 17:23:03 +02:00
Thorsten Eckel
b2c065812f Refactoring: Migrated Kernel.const_get to Rails .constantize. 2019-01-06 19:41:29 +01:00
Thorsten Eckel
e8a57517f4 Updated rubocop - applied custom Layout/AlignHash style. 2018-12-19 18:33:22 +01:00
Thorsten Eckel
9af50f2a4e Updated rubocop to latest version (0.59.2) and applied required changes. 2018-10-09 08:17:41 +02:00
Martin Edenhofer
6cd63bde54 Added api doc to controller (and also to docs repo). 2018-08-16 13:13:20 +02:00
Thorsten Eckel
705487154c Applied changes for Rubocop 0.51. 2017-11-23 09:09:44 +01:00
Martin Edenhofer
460182e663 Small code cleanup. 2017-11-21 15:25:04 +01:00
Thorsten Eckel
757f0ac9bd Applied RuboCop Style/BlockDelimiters to improve readability. 2017-10-01 14:25:52 +02:00
Martin Edenhofer
cd28e904ac Improved session validation and usage of cors headers. 2017-02-15 13:29:25 +01:00
Martin Edenhofer
3e44a2cb43 Merge branch 'private-permission-active2' into develop 2016-10-19 05:25:25 +02:00
Martin Edenhofer
c71b0d36d4 Updated copyright. 2016-10-19 05:11:36 +02:00
Martin Edenhofer
dc7354223a Added permission.active attribute to disable features. 2016-09-22 21:05:29 +02:00
Thorsten Eckel
fa4e953423 Added token attributes last_used_at and expires_at. 2016-08-30 16:26:42 +02:00
Martin Edenhofer
c6eaa84487 Added multi permission check to Token.check. 2016-08-17 13:24:51 +02:00
Martin Edenhofer
731c237d0c Improved permission check of personal tokens. 2016-08-16 10:00:44 +02:00
Martin Edenhofer
e7960ab03b Init version of permission management of personal tokens. 2016-08-16 09:09:09 +02:00
Martin Edenhofer
81b48a2ef4 Moved from to new permission management. 2016-08-12 18:39:09 +02:00
Martin Edenhofer
e200378dd6 Added api setting to admin interface and tokens to user preferences. 2016-07-28 12:09:32 +02:00