-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: third party apps #1832
base: main
Are you sure you want to change the base?
feat: third party apps #1832
Conversation
7346f79
to
06b75d2
Compare
app/api/api.rb
Outdated
@@ -62,6 +62,7 @@ def authenticate! | |||
def is_public_request? | |||
request.path.start_with?( | |||
'/api/v1/public/', | |||
'/api/v1/public_third_party_app/', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/BlockLength: Block has too many lines. [83/25]
result = ThirdPartyApp.all_names | ||
if result.nil? | ||
{ message: 'Name is unique' } | ||
elsif ThirdPartyApp.all_names.exclude?(params[:name]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/DuplicateBranch: Duplicate branch body detected.
|
||
desc 'get public ip address of ELN' | ||
get 'public_IP' do | ||
uri = URI.parse(ENV['PUBLIC_URL'] || 'http://localhost:3000') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/UselessAssignment: Useless assignment to variable - uri
.
get 'public_IP' do | ||
uri = URI.parse(ENV['PUBLIC_URL'] || 'http://localhost:3000') | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/TrailingWhitespace: Trailing whitespace detected.
@@ -0,0 +1,5 @@ | |||
require 'rails_helper' | |||
|
|||
RSpec.describe LabelInfo, type: :model do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RSpecRails/InferredSpecType: Remove redundant spec type.
|
||
require 'rails_helper' | ||
|
||
RSpec.describe ThirdPartyApp, type: :model do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RSpecRails/InferredSpecType: Remove redundant spec type.
describe '.all_names' do | ||
context 'when entries exist' do | ||
before do | ||
described_class.create(IPAddress: "http://test.com", name: "Test1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
context 'when entries exist' do | ||
before do | ||
described_class.create(IPAddress: "http://test.com", name: "Test1") | ||
described_class.create(IPAddress: "http://test.com", name: "Test2") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
end | ||
|
||
it 'returns an array of names' do | ||
expected_names = ['Test1', 'Test2'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/WordArray: Use %w
or %W
for an array of words.
c791ac3
to
6cc4cfc
Compare
4e4f66a
to
aac906c
Compare
@@ -29,6 +29,7 @@ class UiAPI < Grape::API | |||
has_converter: converter_config.present?, | |||
has_radar: radar_config.present?, | |||
collector_address: collector_address.presence, | |||
third_party_apps: ThirdPartyApp.all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/TrailingCommaInHashLiteral: Put a comma after the last item of a multiline hash.
4b801bc
to
934dbd2
Compare
This code enables the communication of the ELN with third party apps (TPAs) - in the admin dashboard code is added to register TPAs (name and ip address) - in the research plan/attachment the user can send files to TPAs - The public api contains method for TPAs to download or upload a file removed the namespaces in the grape api file third_party_apps.rb. Adapted the fetchers to the modifications Combined three migration files into one. - json web token is now created using the model class json_web_token - the download and upload routes are moved from public_api.rb to third_party_apps_api.rb - updated tests - test that user is admin is now conducted analogous as in admin_api.rb - During creation of a new third party app entry the check whether the name is unique is now handled at the backend site - the token for the third party app is now cached - Moreover, a counter for each token is cached. Any third party app is only allowed to upload 30 files. squash dev commit + merge main Squashed commit of the following: commit 7346f79 Author: PiTrem <pierre.tremouilhac@kit.edu> Date: Mon Apr 15 12:17:28 2024 +0200 TPA-mix (#1873) commit a38559d Merge: 63a3ee2 faf6f62 Author: Konrad1991 <konrad_kraemer@yahoo.de> Date: Tue Jan 2 09:58:12 2024 +0100 the public url is now passed as query parameters to the third party app Merge remote-tracking branch 'local/Third-Party-Apps' into Third-Party-Apps commit faf6f62 Author: Konrad1991 <konrad_kraemer@yahoo.de> Date: Tue Jan 2 09:56:30 2024 +0100 the public url of the ELN is send now as query parameter to third party apps. The third party app uses this ip address to make get and post request commit 63a3ee2 Merge: 53b59de 2f37f8b Author: Konrad1991 <konrad_kraemer@yahoo.de> Date: Mon Oct 30 10:04:19 2023 +0100 Removed error which occured due to nil instead of an empty array for ThirdPartyAppNames Merge remote-tracking branch 'local/Third-Party-Apps' into Third-Party-Apps commit 2f37f8b Author: Konrad1991 <konrad_kraemer@yahoo.de> Date: Mon Oct 30 10:01:29 2023 +0100 removed bug of empty ThirdPartyApp array when no TPA's exists commit 53b59de Author: Konrad1991 <konrad_kraemer@yahoo.de> Date: Mon Oct 16 09:50:52 2023 +0200 enabled file-cache in development and production environment. commit ad49f4c Merge: db2a9ce f07eca3 Author: Konrad1991 <konrad_kraemer@yahoo.de> Date: Mon Oct 16 09:42:55 2023 +0200 Merge remote-tracking branch 'local/Third-Party-Apps' into Third-Party-Apps commit f07eca3 Author: Konrad1991 <konrad_kraemer@yahoo.de> Date: Mon Oct 16 09:42:18 2023 +0200 run ESLINT and removed errors for TPA stuff commit db2a9ce Merge: 4fe35ba 236f34a Author: Konrad1991 <konrad_kraemer@yahoo.de> Date: Wed Jul 19 09:45:26 2023 +0200 Merge remote-tracking branch 'local/Third-Party-Apps' into Third-Party-Apps commit 236f34a Author: Konrad1991 <konrad_kraemer@yahoo.de> Date: Wed Jul 19 09:44:00 2023 +0200 - The token which is generated for the third party app is now cached - within the cache the token itself, a counter and the name of the third party app is stored+ - the upload and download to/from the ELN by the third party app is limited by the counter commit 4fe35ba Merge: 39d2824 73260b3 Author: Konrad1991 <konrad_kraemer@yahoo.de> Date: Wed Jul 19 09:42:22 2023 +0200 Merge remote-tracking branch 'upstream/main' into Third-Party-Apps commit 39d2824 Author: Konrad1991 <konrad_kraemer@yahoo.de> Date: Thu Jul 13 15:01:09 2023 +0200 - the token for the third party app is now cached - Moreover, a counter for each token is cached. Any third party app is only allowed to upload 30 files. commit ede8e53 Author: Konrad1991 <konrad_kraemer@yahoo.de> Date: Fri Jul 7 12:00:23 2023 +0200 - During creation of a new third party app entry the check whether the name is unique is now handled at the backend site commit 80caa1a Author: Konrad1991 <konrad_kraemer@yahoo.de> Date: Fri Jul 7 10:54:33 2023 +0200 - json web token is now created using the model class json_web_token - the download and upload routes are moved from public_api.rb to third_party_apps_api.rb - updated tests - test that user is admin is now conducted analogous as in admin_api.rb commit c6b3956 Author: Konrad1991 <konrad_kraemer@yahoo.de> Date: Tue Jun 27 12:46:11 2023 +0200 Combined three migration files into one. commit f008d73 Author: Konrad1991 <konrad_kraemer@yahoo.de> Date: Mon Jun 26 10:37:55 2023 +0200 removed the namespaces in the grape api file third_party_apps.rb. Adapted the fetchers to the modifications commit 091bb30 Author: Konrad1991 <konrad_kraemer@yahoo.de> Date: Mon Jun 19 14:01:43 2023 +0200 Communication with Third Party App This code enables the communication of the ELN with third party apps (TPAs) - in the admin dashboard code is added to register TPAs (name and ip address) - in the research plan/attachment the user can send files to TPAs - The public api contains method for TPAs to download or upload a file
Internal: revamp TPA api - instantiate local file cache - UI: rm former TPA Btn internal: fix admin TPA edit - filename parameters optional on upload - handle api record not found / invalid
Code to enable communication between the ELN and TPAs