Switch service LDAP attribute to serviceEnabled
Improve internal naming on the way
This commit is contained in:
@@ -66,7 +66,7 @@ RSpec.describe User, type: :model do
|
||||
it "returns the entries from the LDAP service attribute" do
|
||||
expect(user).to receive(:ldap_entry).and_return({
|
||||
uid: user.cn, ou: user.ou, mail: user.email, admin: nil,
|
||||
service: ["discourse", "email", "gitea", "wiki", "xmpp"]
|
||||
services_enabled: ["discourse", "email", "gitea", "wiki", "xmpp"]
|
||||
})
|
||||
expect(user.services_enabled).to eq(["discourse", "email", "gitea", "wiki", "xmpp"])
|
||||
end
|
||||
@@ -76,21 +76,21 @@ RSpec.describe User, type: :model do
|
||||
before do
|
||||
allow(user).to receive(:ldap_entry).and_return({
|
||||
uid: user.cn, ou: user.ou, mail: user.email, admin: nil,
|
||||
service: ["discourse", "gitea"]
|
||||
services_enabled: ["discourse", "gitea"]
|
||||
})
|
||||
allow(user).to receive(:dn).and_return(dn)
|
||||
end
|
||||
|
||||
it "adds the service to the LDAP entry" do
|
||||
expect_any_instance_of(LdapService).to receive(:replace_attribute)
|
||||
.with(dn, :service, ["discourse", "gitea", "wiki"]).and_return(true)
|
||||
.with(dn, :serviceEnabled, ["discourse", "gitea", "wiki"]).and_return(true)
|
||||
|
||||
user.enable_service(:wiki)
|
||||
end
|
||||
|
||||
it "adds multiple service to the LDAP entry" do
|
||||
expect_any_instance_of(LdapService).to receive(:replace_attribute)
|
||||
.with(dn, :service, ["discourse", "gitea", "wiki", "xmpp"]).and_return(true)
|
||||
.with(dn, :serviceEnabled, ["discourse", "gitea", "wiki", "xmpp"]).and_return(true)
|
||||
|
||||
user.enable_service([:wiki, :xmpp])
|
||||
end
|
||||
@@ -100,21 +100,21 @@ RSpec.describe User, type: :model do
|
||||
before do
|
||||
allow(user).to receive(:ldap_entry).and_return({
|
||||
uid: user.cn, ou: user.ou, mail: user.email, admin: nil,
|
||||
service: ["discourse", "gitea", "xmpp"]
|
||||
services_enabled: ["discourse", "gitea", "xmpp"]
|
||||
})
|
||||
allow(user).to receive(:dn).and_return(dn)
|
||||
end
|
||||
|
||||
it "removes the service from the LDAP entry" do
|
||||
expect_any_instance_of(LdapService).to receive(:replace_attribute)
|
||||
.with(dn, :service, ["discourse", "gitea"]).and_return(true)
|
||||
.with(dn, :serviceEnabled, ["discourse", "gitea"]).and_return(true)
|
||||
|
||||
user.disable_service(:xmpp)
|
||||
end
|
||||
|
||||
it "removes multiple services from the LDAP entry" do
|
||||
expect_any_instance_of(LdapService).to receive(:replace_attribute)
|
||||
.with(dn, :service, ["discourse"]).and_return(true)
|
||||
.with(dn, :serviceEnabled, ["discourse"]).and_return(true)
|
||||
|
||||
user.disable_service([:xmpp, "gitea"])
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user