bsw/jbe@1309: SystemApplication = mondelefant.new_class() bsw/jbe@1309: SystemApplication.table = 'system_application' bsw/jbe@1309: bsw/jbe@1309: bsw/jbe@1309: function SystemApplication:by_client_id(client_id) bsw/jbe@1309: local system_application = self:new_selector() bsw/jbe@1309: :add_where{ "client_id = ?", client_id } bsw/jbe@1309: :optional_object_mode() bsw/jbe@1309: :exec() bsw/jbe@1309: return system_application bsw/jbe@1309: end bsw/jbe@1309: bsw/jbe@1309: function SystemApplication:by_origin(origin) bsw/jbe@1309: local system_applications = self:new_selector() bsw/jbe@1309: :set_distinct() bsw/jbe@1309: :left_join("system_application_redirect_uri", nil, "system_application_redirect_uri.system_application_id = system_application.id") bsw/jbe@1309: :add_where{ "lower(regexp_replace(system_application.default_redirect_uri, '^([^:]+://[^/]+)/.*', E'\\\\1', 'i')) = lower(?) OR lower(regexp_replace(system_application_redirect_uri.redirect_uri, '^([^:]+://[^/]+)/.*', E'\\\\1', 'i')) = lower(?)", origin, origin } bsw/jbe@1309: :exec() bsw/jbe@1309: return system_applications bsw/jbe@1309: end bsw/jbe@1309: bsw/jbe@1309: function SystemApplication:get_all() bsw/jbe@1309: local system_application = self:new_selector() bsw/jbe@1309: :exec() bsw/jbe@1309: return system_application bsw/jbe@1309: end bsw/jbe@1309: bsw/jbe@1309: