Crystal bindings: authd: no need for events in 'handle' methods.

master
Philippe Pittoli 2023-02-01 11:17:18 +01:00
parent 79752068c6
commit db561d99b5
11 changed files with 19 additions and 19 deletions

View File

@ -13,7 +13,7 @@ class AuthD::Request
def initialize(@shared_key, @login, @password, @email, @phone, @profile)
end
def handle(authd : AuthD::Service, event : IPC::Event::Events)
def handle(authd : AuthD::Service)
# No verification of the users' informations when an admin adds it.
# No mail address verification.
if @shared_key != authd.configuration.shared_key
@ -63,7 +63,7 @@ class AuthD::Request
def initialize(@shared_key, @user)
end
def handle(authd : AuthD::Service, event : IPC::Event::Events)
def handle(authd : AuthD::Service)
if @shared_key != authd.configuration.shared_key
return Response::Error.new "invalid authentication key"
end

View File

@ -8,7 +8,7 @@ class AuthD::Request
def initialize(@token)
end
def handle(authd : AuthD::Service, event : IPC::Event::Events)
def handle(authd : AuthD::Service)
user = authd.get_user_from_token @token
return Response::Error.new "invalid user" unless user
@ -32,7 +32,7 @@ class AuthD::Request
def initialize(@token)
end
def handle(authd : AuthD::Service, event : IPC::Event::Events)
def handle(authd : AuthD::Service)
user = authd.get_user_from_token @token
return Response::Error.new "invalid user" unless user

View File

@ -13,7 +13,7 @@ class AuthD::Request
def initialize(@user, @shared_key)
end
def handle(authd : AuthD::Service, event : IPC::Event::Events)
def handle(authd : AuthD::Service)
uid_or_login = @user
user_to_delete = if uid_or_login.is_a? Int32
authd.users_per_uid.get? uid_or_login.to_s

View File

@ -6,7 +6,7 @@ class AuthD::Request
def initialize(@token, @key)
end
def handle(authd : AuthD::Service, event : IPC::Event::Events)
def handle(authd : AuthD::Service)
# FIXME: Lines too long, repeatedly (>80c with 4c tabs).
@token.try do |token|
user = authd.get_user_from_token token

View File

@ -7,7 +7,7 @@ class AuthD::Request
def initialize(@login, @old_password, @new_password)
end
def handle(authd : AuthD::Service, event : IPC::Event::Events)
def handle(authd : AuthD::Service)
user = authd.users_per_login.get? @login
unless user
@ -35,7 +35,7 @@ class AuthD::Request
def initialize(@user, @password_renew_key, @new_password)
end
def handle(authd : AuthD::Service, event : IPC::Event::Events)
def handle(authd : AuthD::Service)
uid_or_login = @user
user = if uid_or_login.is_a? Int32
authd.users_per_uid.get? uid_or_login.to_s
@ -69,7 +69,7 @@ class AuthD::Request
def initialize(@user, @email)
end
def handle(authd : AuthD::Service, event : IPC::Event::Events)
def handle(authd : AuthD::Service)
uid_or_login = @user
user = if uid_or_login.is_a? Int32
authd.users_per_uid.get? uid_or_login.to_s

View File

@ -10,7 +10,7 @@ class AuthD::Request
def initialize(@shared_key, @user, @service, @resource)
end
def handle(authd : AuthD::Service, event : IPC::Event::Events)
def handle(authd : AuthD::Service)
authorized = false
if key = @shared_key
@ -79,7 +79,7 @@ class AuthD::Request
def initialize(@shared_key, @user, @service, @resource, @permission)
end
def handle(authd : AuthD::Service, event : IPC::Event::Events)
def handle(authd : AuthD::Service)
unless @shared_key == authd.configuration.shared_key
return Response::Error.new "unauthorized"
end

View File

@ -6,7 +6,7 @@ class AuthD::Request
def initialize(@token, @new_profile)
end
def handle(authd : AuthD::Service, event : IPC::Event::Events)
def handle(authd : AuthD::Service)
user = authd.get_user_from_token @token
return Response::Error.new "invalid user" unless user
@ -45,7 +45,7 @@ class AuthD::Request
def initialize(@token, @new_profile)
end
def handle(authd : AuthD::Service, event : IPC::Event::Events)
def handle(authd : AuthD::Service)
user = if token = @token
u = authd.get_user_from_token token
raise UserNotFound.new unless u

View File

@ -9,7 +9,7 @@ class AuthD::Request
def initialize(@login, @password, @email, @phone, @profile)
end
def handle(authd : AuthD::Service, event : IPC::Event::Events)
def handle(authd : AuthD::Service)
if ! authd.configuration.registrations
return Response::Error.new "registrations not allowed"
end

View File

@ -5,7 +5,7 @@ class AuthD::Request
def initialize(@user)
end
def handle(authd : AuthD::Service, event : IPC::Event::Events)
def handle(authd : AuthD::Service)
pattern = Regex.new @user, Regex::Options::IGNORE_CASE
matching_users = Array(AuthD::User::Public).new

View File

@ -6,7 +6,7 @@ class AuthD::Request
def initialize(@login, @password)
end
def handle(authd : AuthD::Service, event : IPC::Event::Events)
def handle(authd : AuthD::Service)
begin
user = authd.users_per_login.get @login
rescue e : DODB::MissingEntry

View File

@ -6,7 +6,7 @@ class AuthD::Request
def initialize(@login, @activation_key)
end
def handle(authd : AuthD::Service, event : IPC::Event::Events)
def handle(authd : AuthD::Service)
user = authd.users_per_login.get? @login
if user.nil?
@ -37,7 +37,7 @@ class AuthD::Request
def initialize(@user)
end
def handle(authd : AuthD::Service, event : IPC::Event::Events)
def handle(authd : AuthD::Service)
uid_or_login = @user
user = if uid_or_login.is_a? Int32
authd.users_per_uid.get? uid_or_login.to_s
@ -61,7 +61,7 @@ class AuthD::Request
def initialize(@login, @password)
end
def handle(authd : AuthD::Service, event : IPC::Event::Events)
def handle(authd : AuthD::Service)
user = authd.users_per_login.get? @login
unless user