diff --git a/app/models/remote_storage_authorization.rb b/app/models/remote_storage_authorization.rb index f1aee26..7a4078a 100644 --- a/app/models/remote_storage_authorization.rb +++ b/app/models/remote_storage_authorization.rb @@ -29,7 +29,7 @@ class RemoteStorageAuthorization < ApplicationRecord end def delete_token_from_redis - key = "rs:authorizations:#{user.address}:#{token}" + key = "authorizations:#{user.cn}:#{token}" redis.srem? key, redis.smembers(key) end @@ -44,7 +44,7 @@ class RemoteStorageAuthorization < ApplicationRecord end def store_token_in_redis - redis.sadd "rs:authorizations:#{user.address}:#{token}", permissions + redis.sadd "authorizations:#{user.cn}:#{token}", permissions end def schedule_token_expiry diff --git a/spec/jobs/remote_storage_expire_authorization_job_spec.rb b/spec/jobs/remote_storage_expire_authorization_job_spec.rb index e65662e..8142983 100644 --- a/spec/jobs/remote_storage_expire_authorization_job_spec.rb +++ b/spec/jobs/remote_storage_expire_authorization_job_spec.rb @@ -20,7 +20,7 @@ RSpec.describe RemoteStorageExpireAuthorizationJob, type: :job do } it "removes the RS authorization from redis" do - redis_key = "rs:authorizations:#{@user.address}:#{@rs_authorization.token}" + redis_key = "authorizations:#{@user.cn}:#{@rs_authorization.token}" expect(redis.keys(redis_key)).to_not be_empty perform_enqueued_jobs { job } diff --git a/spec/models/remote_storage_authorization_spec.rb b/spec/models/remote_storage_authorization_spec.rb index 3d046cf..e98625b 100644 --- a/spec/models/remote_storage_authorization_spec.rb +++ b/spec/models/remote_storage_authorization_spec.rb @@ -7,7 +7,7 @@ RSpec.describe RemoteStorageAuthorization, type: :model do describe "#create" do after(:each) { clear_enqueued_jobs } - after(:all) { redis_rs_delete_keys("rs:authorizations:*") } + after(:all) { redis_rs_delete_keys("authorizations:*") } let(:auth) do user.remote_storage_authorizations.create!( @@ -22,7 +22,7 @@ RSpec.describe RemoteStorageAuthorization, type: :model do end it "stores a token in redis" do - user_auth_keys = redis_rs.keys("rs:authorizations:#{user.address}:*") + user_auth_keys = redis_rs.keys("authorizations:#{user.cn}:*") expect(user_auth_keys.length).to eq(1) authorizations = redis_rs.smembers(user_auth_keys.first) @@ -44,7 +44,7 @@ RSpec.describe RemoteStorageAuthorization, type: :model do describe "#destroy" do after(:each) { clear_enqueued_jobs } - after(:all) { redis_rs_delete_keys("rs:authorizations:*") } + after(:all) { redis_rs_delete_keys("authorizations:*") } it "removes the token from redis" do auth = user.remote_storage_authorizations.create!( @@ -54,7 +54,7 @@ RSpec.describe RemoteStorageAuthorization, type: :model do ) auth.destroy! - expect(redis_rs.keys("rs:authorizations:#{user.address}:*")).to be_empty + expect(redis_rs.keys("authorizations:#{user.address}:*")).to be_empty end context "with expiry set" do