20 Commits

Author SHA1 Message Date
Michał Hudobski
3025a35aa6 auth: add possibilty to check for any permission in set
This commit adds a new version of command_desc struct
that contains a set of permissions instead of a singular
permission. When this struct is passed to ensure/check_has_permission,
we check if the user has any of the included permission on the resource.
2025-10-03 16:55:57 +02:00
Avi Kivity
f3eade2f62 treewide: relicense to ScyllaDB-Source-Available-1.0
Drop the AGPL license in favor of a source-available license.
See the blog post [1] for details.

[1] https://www.scylladb.com/2024/12/18/why-were-moving-to-a-source-available-license/
2024-12-18 17:45:13 +02:00
Avi Kivity
aa1270a00c treewide: change assert() to SCYLLA_ASSERT()
assert() is traditionally disabled in release builds, but not in
scylladb. This hasn't caused problems so far, but the latest abseil
release includes a commit [1] that causes a 1000 insn/op regression when
NDEBUG is not defined.

Clearly, we must move towards a build system where NDEBUG is defined in
release builds. But we can't just define it blindly without vetting
all the assert() calls, as some were written with the expectation that
they are enabled in release mode.

To solve the conundrum, change all assert() calls to a new SCYLLA_ASSERT()
macro in utils/assert.hh. This macro is always defined and is not conditional
on NDEBUG, so we can later (after vetting Seastar) enable NDEBUG in release
mode.

[1] 66ef711d68

Closes scylladb/scylladb#20006
2024-08-05 08:23:35 +03:00
Avi Kivity
fcb8d040e8 treewide: use Software Package Data Exchange (SPDX) license identifiers
Instead of lengthy blurbs, switch to single-line, machine-readable
standardized (https://spdx.dev) license identifiers. The Linux kernel
switched long ago, so there is strong precedent.

Three cases are handled: AGPL-only, Apache-only, and dual licensed.
For the latter case, I chose (AGPL-3.0-or-later and Apache-2.0),
reasoning that our changes are extensive enough to apply our license.

The changes we applied mechanically with a script, except to
licenses/README.md.

Closes #9937
2022-01-18 12:15:18 +01:00
Botond Dénes
96c95119f9 enum_set: add toggle() 2021-09-13 18:05:11 +03:00
Avi Kivity
a55b434a2b treewide: extent copyright statements to present day 2021-06-06 19:18:49 +03:00
Konstantin Osipov
4d214b624b lwt: ensure enum_set::of is constexpr.
This allows using it to initialize const static members.
Message-Id: <20190930200530.40063-2-kostja@scylladb.com>
2019-10-01 19:45:56 +02:00
Piotr Sarna
989c31f68b cql3: allow adding enum_sets
Enum set can now be added to another enum set in order to create
a sum of both.
2019-07-29 17:15:51 +02:00
Tomasz Grabiec
f33f0d759d enum_set: Introduce full() 2019-04-28 15:50:12 +02:00
Jesse Haber-Kucharsky
f4fc12fbf0 enum_set: Add iterator
Sometimes it is useful to be able to query for all the members of an
`enum_set`, rather than just add, remove, and query for membership. (The
patch following this one makes use of this in the auth. sub-system).

We use the bitset iterator in Seastar to help with the implementation.
2018-02-14 14:15:59 -05:00
Jesse Haber-Kucharsky
bbe09a4793 enum_set: Throw on bad mask
`super_enum::valid_is_valid_sequence` determines if the numeric index
corresponding to an enumeration value is valid. This is important,
because it is undefined behavior to cast an invalid index into an
enumeration value.

This function is used to check the validity of the `enum_set` mask when
an `enum_set` is constructed in `enum_set::from_mask`. If the mask has
set bits that correspond to invalid enumeration indicies, then we throw
`bad_enum_set_mask`.
2018-02-14 14:15:59 -05:00
Pekka Enberg
38a54df863 Fix pre-ScyllaDB copyright statements
People keep tripping over the old copyrights and copy-pasting them to
new files. Search and replace "Cloudius Systems" with "ScyllaDB".

Message-Id: <1460013664-25966-1-git-send-email-penberg@scylladb.com>
2016-04-08 08:12:47 +03:00
Avi Kivity
d5cf0fb2b1 Add license notices 2015-09-20 10:43:39 +03:00
Tomasz Grabiec
6c3d57696f enum_set: Introduce enum_set::of<>() 2015-04-15 20:33:49 +02:00
Tomasz Grabiec
a720f24c3c enum_set: Introduce frozen<>::unfreeze() 2015-04-15 20:33:48 +02:00
Tomasz Grabiec
57e74d2096 enum_set: Introduce set_if()
This:

  set_if<item>(cond);

is a more efficient version of:

  if (cond) {
     set<item>();
  }

The implementation can leverage internal representation to avoid
branching and thus make the operation cheaper.
2015-04-15 20:33:48 +02:00
Tomasz Grabiec
53eb4ab35d enum_set: Add mask getter 2015-03-11 14:56:09 +01:00
Tomasz Grabiec
13850d912e enum_set: Add more operations 2015-03-11 14:56:09 +01:00
Tomasz Grabiec
29f02b5c65 enum_set: Add more operations 2015-02-16 12:15:11 +01:00
Tomasz Grabiec
16a4b2f3e0 Introduce enum_set
Allows to take full advantage of compile-time information.

Examples:

  enum class x { A, B, C };
  using my_enum = super_enum<x, x::A, x::B, x::C>;
  using my_enumset = enum_set<my_enum>;

  static_assert(my_enumset::frozen<x::A, x::B>::contains<x::A>(),
  		"it should...");

  assert(my_enumset::frozen<x::A, x::B>::contains(x::A));
2015-02-12 19:40:56 +01:00