gitlab-glaz 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Cargo.toml CHANGED
@@ -4,7 +4,7 @@ members = ["ext/*"]
4
4
  resolver = "2"
5
5
 
6
6
  [workspace.package]
7
- version = "2.0.0"
7
+ version = "2.1.0"
8
8
  edition = "2024"
9
9
 
10
10
  # Shared dependencies for all crates
data/ext/glaz/src/lib.rs CHANGED
@@ -213,12 +213,18 @@ impl glaz_module::PolicyLookup for NoStore {
213
213
 
214
214
  /// Return the default roles embedded in the extension at build time (parsed
215
215
  /// from glaz-roles' roles/**/*.yml) as an array of hashes shaped like
216
- /// `{ id: String, name: String, permissions: [String, ...] }`.
216
+ /// `{ id: String, key: String, name: String, permissions: [String, ...] }`.
217
+ ///
218
+ /// `key` is the role's stable machine identifier (e.g. `artifact_admin`),
219
+ /// distinct from the human-facing `name` and from the `id` callers put in
220
+ /// relationships. Callers reference a role by `key` instead of hardcoding
221
+ /// its UUID or matching on its display name.
217
222
  fn roles(ruby: &Ruby) -> Result<magnus::RArray, Error> {
218
223
  let array = ruby.ary_new();
219
224
  for role in glaz_roles::default_roles() {
220
225
  let hash = ruby.hash_new();
221
226
  hash.aset(ruby.sym_new("id"), role.id.to_string())?;
227
+ hash.aset(ruby.sym_new("key"), role.key)?;
222
228
  hash.aset(ruby.sym_new("name"), role.name)?;
223
229
  let permissions = ruby.ary_new();
224
230
  for permission in &role.permissions {
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module Glaz
5
- VERSION = "2.0.0"
5
+ VERSION = "2.1.0"
6
6
  end
7
7
  end
data/lib/gitlab/glaz.rb CHANGED
@@ -16,7 +16,12 @@ module Gitlab
16
16
 
17
17
  # Returns the default roles embedded in the native extension at build time,
18
18
  # sourced from the glaz-roles crate's roles/**/*.yml definitions. Each entry
19
- # is a hash: { id: String, name: String, permissions: Array<String> }.
19
+ # is a hash:
20
+ # { id: String, key: String, name: String, permissions: Array<String> }.
21
+ #
22
+ # :key is the role's stable machine identifier (e.g. "artifact_admin"):
23
+ # reference a role by it rather than hardcoding :id or matching on :name,
24
+ # which is human-facing and may be reworded.
20
25
  def roles
21
26
  @roles ||= ::Glaz.roles.each do |role|
22
27
  role[:permissions].freeze
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-glaz
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - group::authorization
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-09-23 00:00:00.000000000 Z
11
+ date: 2026-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf