repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
bonsaiERP/bonsaiERP
https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/config/initializers/dragonfly.rb
config/initializers/dragonfly.rb
require 'dragonfly' # Configure Dragonfly.app.configure do plugin :imagemagick secret "c641addee1481dcfdcc372ba25ee76a433a8ecbf5721b805df5db6e509dce230" url_format "/media/:job/:name" if Rails.env.production? datastore :file, root_path: Rails.root.join('public/system/dragonfly', Rails.env), ...
ruby
MIT
0edb91af594f81e7534dbc90525a406c645ad164
2026-01-04T17:40:51.865869Z
false
bonsaiERP/bonsaiERP
https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/config/initializers/backtrace_silencers.rb
config/initializers/backtrace_silencers.rb
# Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } # You can also remove all the silencers if you're trying to debug a probl...
ruby
MIT
0edb91af594f81e7534dbc90525a406c645ad164
2026-01-04T17:40:51.865869Z
false
bonsaiERP/bonsaiERP
https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/config/initializers/mime_types.rb
config/initializers/mime_types.rb
# Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register_alias "text/html", :iphone Mime::Type.register 'application/xls', :xls Mime::Type.register 'text/html', :print # Mime::Type.register 'applicat...
ruby
MIT
0edb91af594f81e7534dbc90525a406c645ad164
2026-01-04T17:40:51.865869Z
false
bonsaiERP/bonsaiERP
https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/config/initializers/secret_token.rb
config/initializers/secret_token.rb
# Be sure to restart your server when you modify this file. # Your secret key for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attac...
ruby
MIT
0edb91af594f81e7534dbc90525a406c645ad164
2026-01-04T17:40:51.865869Z
false
bonsaiERP/bonsaiERP
https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/config/deploy/staging.rb
config/deploy/staging.rb
# Simple Role Syntax # ================== # Supports bulk-adding hosts to roles, the primary server in each group # is considered to be the first unless any hosts have the primary # property set. Don't declare `role :all`, it's a meta role. role :app, %w{pollabolivia.com} role :web, %w{pollabolivia.com} role :db, %w...
ruby
MIT
0edb91af594f81e7534dbc90525a406c645ad164
2026-01-04T17:40:51.865869Z
false
bonsaiERP/bonsaiERP
https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/config/deploy/production.rb
config/deploy/production.rb
# Simple Role Syntax # ================== # Supports bulk-adding hosts to roles, the primary server in each group # is considered to be the first unless any hosts have the primary # property set. Don't declare `role :all`, it's a meta role. role :app, %w{bonsaierp.com} role :web, %w{bonsaierp.com} role :db, %w{bonsa...
ruby
MIT
0edb91af594f81e7534dbc90525a406c645ad164
2026-01-04T17:40:51.865869Z
false
bonsaiERP/bonsaiERP
https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/config/routes/api.rb
config/routes/api.rb
namespace :api do namespace :v1 do resources :attachments, only: [:index, :show, :update] do get :count, on: :collection end resources :contacts, only: [:index, :create, :update] do get :count, on: :collection end resources :incomes, only: [:index, :show, :create, :update] do ...
ruby
MIT
0edb91af594f81e7534dbc90525a406c645ad164
2026-01-04T17:40:51.865869Z
false
bonsaiERP/bonsaiERP
https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/config/routes/app.rb
config/routes/app.rb
get '/download_pdf/:file/:name' => 'download#download_pdf', as: :download #resources :movement_details_history, only: [:show] get '/movement_details_history/:id' => 'movement_details_history#show', as: :movement_detail_history # Batch payments post 'batch_paymets/income' => 'batch_payments#income', as: :income_batch_...
ruby
MIT
0edb91af594f81e7534dbc90525a406c645ad164
2026-01-04T17:40:51.865869Z
false
bonsaiERP/bonsaiERP
https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/config/environments/test.rb
config/environments/test.rb
Bonsaierp::Application.configure do # Settings specified here will take precedence over those in config/application.rb. # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test...
ruby
MIT
0edb91af594f81e7534dbc90525a406c645ad164
2026-01-04T17:40:51.865869Z
false
bonsaiERP/bonsaiERP
https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/config/environments/development.rb
config/environments/development.rb
Bonsaierp::Application.configure do # Settings specified here will take precedence over those in config/environment.rb # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web...
ruby
MIT
0edb91af594f81e7534dbc90525a406c645ad164
2026-01-04T17:40:51.865869Z
false
bonsaiERP/bonsaiERP
https://github.com/bonsaiERP/bonsaiERP/blob/0edb91af594f81e7534dbc90525a406c645ad164/config/environments/production.rb
config/environments/production.rb
Bonsaierp::Application.configure do # Settings specified here will take precedence over those in config/application.rb # Code is not reloaded between requests config.cache_classes = true # Full error reports are disabled and caching is turned on config.consider_all_requests_local = false config.acti...
ruby
MIT
0edb91af594f81e7534dbc90525a406c645ad164
2026-01-04T17:40:51.865869Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/scripts/benchmark/profiles.rb
scripts/benchmark/profiles.rb
require 'benchmark' require_relative "../../config/environment" # Check only Error logs ActiveRecord::Base.logger.level = 3 ## Before benchmark user = User.find_or_create_by(uid: "UIDExample", email: 'test_example@gmail.com') do |u| u.password = "PasswordExample12" end # Benchmark puts '---------------------------...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/scripts/benchmark/phones.rb
scripts/benchmark/phones.rb
require 'benchmark' require_relative "../../config/environment" # Check only Error logs ActiveRecord::Base.logger.level = 3 ## Before benchmark user = User.find_or_create_by(uid: "UIDExample", email: 'test_example@gmail.com') do |u| u.password = "PasswordExample12" end # Benchmark puts '---------------------------...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/jobs/application_job.rb
app/jobs/application_job.rb
class ApplicationJob < ActiveJob::Base end
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/uploaders/ali_uploader.rb
app/uploaders/ali_uploader.rb
# frozen_string_literal: true require 'aliyun/oss' class AliUploader < UploadUploader def url bucket.object_url(Barong::App.config.storage_bucket_name + '/' + path) end def bucket @_bucket = client.get_bucket(Barong::App.config.storage_bucket_name) end def client @_client ||= Aliyun::OSS::Clie...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/uploaders/upload_uploader.rb
app/uploaders/upload_uploader.rb
# frozen_string_literal: true # It's for upload document for Document model class UploadUploader < CarrierWave::Uploader::Base if Rails.env.production? storage :fog else storage :file end # Override the directory where uploaded files will be stored. # This is a sensible default for uploaders that ar...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/services/kyc_service.rb
app/services/kyc_service.rb
# frozen_string_literal: true class KycService # passport front + selfie OR driver license front and back + selfie IR id card front and back + selfie REQUIRED_DOC_AMOUNT = { 'Passport': 2, 'Driver license': 3, 'Identity card': 3 }.freeze class << self def profile_step(profile) user = profile.user ...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/services/twilio_sms_send_service.rb
app/services/twilio_sms_send_service.rb
# frozen_string_literal: true # twilio sms sender class TwilioSmsSendService class << self def send_confirmation(phone, _channel) Rails.logger.info("Sending SMS to #{phone.number}") send_sms(number: phone.number, content: Barong::App.config.sms_content_template.gsub(/{{code}}/, phone....
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/services/totp_service.rb
app/services/totp_service.rb
# frozen_string_literal: true class TOTPService Error = Class.new(StandardError) class <<self ISSUER_NAME = 'Barong' def server_available? read_data('sys/health').present? rescue StandardError false end def otp_secret(otp) CGI.parse(URI.parse(otp.data[:url]).query)['sec...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/services/event_mailer.rb
app/services/event_mailer.rb
# frozen_string_literal: true require 'bunny' require 'ostruct' class EventMailer Error = Class.new(StandardError) class VerificationError < Error; end def initialize(events, exchanges, keychain) @exchanges = exchanges @keychain = keychain @events = events Kernel.at_exit { unlisten } end ...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/services/api_keys_verifier.rb
app/services/api_keys_verifier.rb
# frozen_string_literal: true class APIKeysVerifier def initialize(params = {}) @kid = params[:kid] @signature = params[:signature] @nonce = params[:nonce] || nil @api_key = APIKey.find_by!(kid: @kid) end def verify_hmac_payload? data = @nonce.to_s + @kid algorithm = 'SHA' + @api_key.alg...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/services/secret_storage.rb
app/services/secret_storage.rb
# frozen_string_literal: true module SecretStorage Error = Class.new(StandardError) class <<self def server_available? read_data('sys/health').present? rescue StandardError false end def store_secret(secret, kid) write!(secret_path(kid), secret) unless exist?(kid) end ...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/services/twilio_verify_service.rb
app/services/twilio_verify_service.rb
# frozen_string_literal: true # twilio process verification class TwilioVerifyService class << self def send_confirmation(phone, channel) Rails.logger.info("Sending code to #{phone.number} via #{channel}") send_code(number: phone.number, channel: channel) end def send_code(number:, channel:...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/services/uid_generator.rb
app/services/uid_generator.rb
# frozen_string_literal: true class UIDGenerator def self.generate(prefix = 'ID') loop do uid = "%s%s" % [prefix.upcase, SecureRandom.hex(5).upcase] return uid if User.where(uid: uid).empty? && ServiceAccount.where(uid: uid).empty? end end end
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/services/password_strength_checker.rb
app/services/password_strength_checker.rb
# frozen_string_literal: true # password entropy calculation class PasswordStrengthChecker class <<self # this method typically called by validate! from model and from API /pass/validate controller def calculate_entropy(password) @checker ||= StrongPassword::StrengthChecker.new(min_entropy: Barong::App...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/services/encryption_service.rb
app/services/encryption_service.rb
# frozen_string_literal: true class EncryptionService # Example: 202040 # Week number starts from 0 def self.current_salt Time.now.strftime('%Y%W') end def self.pack(salt, value) [salt, value].join('.') end def self.unpack(str) raise "Invalid encrypted value: #{str}" unless str =~ (/(\w*)\....
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/services/mock_phone_verify_service.rb
app/services/mock_phone_verify_service.rb
# frozen_string_literal: true # twilio sms sender class MockPhoneVerifyService class << self def send_confirmation(phone, _channel) Rails.logger.info("Sending SMS to #{phone.number}") send_sms(number: phone.number, content: Barong::App.config.sms_content_template.gsub(/{{code}}/, phon...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/services/captcha_service.rb
app/services/captcha_service.rb
# frozen_string_literal: true require 'digest' require 'net/http' module CaptchaService # Google recaptcha verifier class RecaptchaVerifier include Recaptcha::Adapters::ControllerMethods attr_reader :request def initialize(request:) @request = request end def response_valid?(skip_remo...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/workers/kyc/kycaid/applicant_worker.rb
app/workers/kyc/kycaid/applicant_worker.rb
require 'sidekiq' module KYC module Kycaid class ApplicantWorker include Sidekiq::Worker def perform(profile_id) profile = Profile.find(profile_id) params = { type: 'PERSON', first_name: profile.first_name, last_name: profile.last_name, dob: pr...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/workers/kyc/kycaid/address_worker.rb
app/workers/kyc/kycaid/address_worker.rb
require 'sidekiq' module KYC module Kycaid class AddressWorker include Sidekiq::Worker def perform(params = {}) @params = params.symbolize_keys @user = User.find(@params[:user_id]) @applicant_id = @user.profiles.last.applicant_id @document = Document.find_by(identifi...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/workers/kyc/kycaid/document_worker.rb
app/workers/kyc/kycaid/document_worker.rb
require 'sidekiq' module KYC module Kycaid class DocumentWorker include Sidekiq::Worker KYCAID_DOC_TYPES = { "Passport" => 'PASSPORT', 'Identity card' => 'GOVERNMENT_ID', 'Driver license' => 'DRIVERS_LICENSE' }.freeze def perform(user_id, identificator) # user, that will be verified ...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/workers/kyc/kycaid/verifications_worker.rb
app/workers/kyc/kycaid/verifications_worker.rb
require 'sidekiq' module KYC module Kycaid class VerificationsWorker include Sidekiq::Worker def perform(params) params = params.symbolize_keys params.slice(:verification_id, :applicant_id, :verified, :verifications) user = Profile.find_by(applicant_id: params[:applicant_id])...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/helpers/application_helper.rb
app/helpers/application_helper.rb
module ApplicationHelper end
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/helpers/salted_crc32.rb
app/helpers/salted_crc32.rb
# frozen_string_literal: true class SaltedCrc32 def self.generate_hash(value) Zlib::crc32(value + Barong::App.config.crc32_salt) end end
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/controllers/authorize_controller.rb
app/controllers/authorize_controller.rb
# frozen_string_literal: true require_dependency 'barong/authorize' # Rails Metal base controller to manage AuthZ story class AuthorizeController < ActionController::Metal include AbstractController::Rendering # /api/v2/auth endpoint def authorize @restrictions = Rails.cache.fetch('restrictions', expires_i...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/controllers/application_controller.rb
app/controllers/application_controller.rb
class ApplicationController < ActionController::Base end
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/models/restriction.rb
app/models/restriction.rb
# frozen_string_literal: true class Restriction < ApplicationRecord # please, note that order in CATEGORIES contstant defines the ierarchy CATEGORIES = %w[whitelist maintenance blacklist blocklogin].freeze SCOPES = %w[continent country ip ip_subnet all] # 423 Locked 403 Forbidden 401 Forbidden DEFAULT_CODES ...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/models/permission.rb
app/models/permission.rb
# frozen_string_literal: true # Permissions model for RBAC class Permission < ApplicationRecord validates :role, :verb, :action, :path, presence: true before_validation :upcase_action_verb private def upcase_action_verb return if action.blank? || verb.blank? self.action.upcase! self.verb.upcase...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/models/admin_ability.rb
app/models/admin_ability.rb
# frozen_string_literal: true class AdminAbility include CanCan::Ability def initialize(user) return if Ability.admin_permissions[user.role].nil? # Iterate through user permissions Ability.admin_permissions[user.role].each do |action, models| # Iterate through a list of user model access ...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/models/service_account.rb
app/models/service_account.rb
# frozen_string_literal: true # ServiceAccount model class ServiceAccount < ApplicationRecord UID_PREFIX = 'SI' belongs_to :user, foreign_key: "owner_id", optional: true has_many :api_keys, as: :key_holder_account, dependent: :destroy, class_name: 'APIKey' validate :role_exists validate :email_n_uid_unique...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/models/data_storage.rb
app/models/data_storage.rb
# frozen_string_literal: true # Data Storage model class DataStorage < ApplicationRecord BLACKLISTED_TITLES = %w[document label profile phone user].freeze acts_as_eventable prefix: 'data_storage', on: %i[create update] belongs_to :user validates :title, :data, presence: true validates_length_of :data, maxi...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/models/ability.rb
app/models/ability.rb
# frozen_string_literal: true # Full list of roles abilities could be found on docs/roles.md class Ability class << self def abilities @abilities ||= YAML.load_file("#{Rails.root}/config/abilities.yml") end def admin_permissions abilities['admin_permissions'] end def roles abi...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/models/comment.rb
app/models/comment.rb
# frozen_string_literal: true class Comment < ApplicationRecord belongs_to :user validates :title, :data, :author_uid, presence: true end # == Schema Information # # Table name: comments # # id :bigint not null, primary key # user_id :bigint unsigned, not null # author_uid :stri...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/models/activity.rb
app/models/activity.rb
class Activity < ApplicationRecord RESULTS = %w[succeed failed denied].freeze CATEGORIES = %w[admin user].freeze belongs_to :user has_one :target, primary_key: :target_uid, foreign_key: :uid, class_name: 'User' validates :user_ip, presence: true, allow_blank: false validates :user_agent, presence: true, t...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/models/application_record.rb
app/models/application_record.rb
class ApplicationRecord < ActiveRecord::Base include Iso8601TimeFormat self.abstract_class = true end
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/models/profile.rb
app/models/profile.rb
# frozen_string_literal: true # Profile model class Profile < ApplicationRecord include Encryptable acts_as_eventable prefix: 'profile', on: %i[create update] belongs_to :user enum state: { drafted: 0, submitted: 1, verified: 3, rejected: 4 } EDITABLE_PARAMS = { drafted: %w[first_name last_name dob addre...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/models/level.rb
app/models/level.rb
# frozen_string_literal: true # Label level mapping model class Level < ApplicationRecord validates :key, :value, :description, presence: true validates :value, uniqueness: { scope: :key } end # == Schema Information # # Table name: levels # # id :bigint not null, primary key # key :s...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/models/phone.rb
app/models/phone.rb
# frozen_string_literal: true # # Class Phone # class Phone < ApplicationRecord include Encryptable TWILIO_CHANNELS = %w[call sms].freeze DEFAULT_COUNTRY_CODE_COUNT = 2 belongs_to :user attr_encrypted :number validates :number, phone: true before_create :generate_code before_validation :parse_count...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/models/api_key.rb
app/models/api_key.rb
# frozen_string_literal: true class APIKey < ApplicationRecord self.table_name = :apikeys include Vault::EncryptedModel ALGORITHMS = ['HS256'].freeze JWT_OPTIONS = { verify_expiration: true, verify_iat: true, verify_jti: true, sub: 'api_key_jwt', verify_sub: true, iss: 'external', ...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/models/document.rb
app/models/document.rb
# frozen_string_literal: true # User document model class Document < ApplicationRecord include Encryptable acts_as_eventable prefix: 'document', on: %i[create] mount_uploader :upload, Barong::App.config.uploader STATES = %w[verified pending replaced rejected].freeze attr_encrypted :doc_number belongs_...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/models/label.rb
app/models/label.rb
# frozen_string_literal: true # Resposible for storing configurations class Label < ApplicationRecord acts_as_eventable prefix: 'label', on: %i[create update] belongs_to :user SCOPES = HashWithIndifferentAccess.new( public: 'public', private: 'private' ) SCOPES.keys.each do |name| define_m...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/models/user.rb
app/models/user.rb
# frozen_string_literal: true # User model class User < ApplicationRecord acts_as_eventable prefix: 'user', on: %i[create update] has_secure_password has_many :profiles, dependent: :destroy has_many :phones, dependent: :destroy has_many :data_storages, dependent: :destroy ...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/models/concerns/iso8601_time_format.rb
app/models/concerns/iso8601_time_format.rb
# frozen_string_literal: true # Convert time to utc 8601 module Iso8601TimeFormat extend ActiveSupport::Concern def format_iso8601_time(time) utc_time = time.respond_to?(:utc) ? time.utc : time utc_time&.iso8601 end end
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/models/concerns/trusty_agent_validator.rb
app/models/concerns/trusty_agent_validator.rb
# frozen_string_literal: true # User agent validator class TrustyAgentValidator < ActiveModel::EachValidator def validate_each(record, _attribute, value) browser = Browser.new(value) return if browser.known? return record.data = { note: 'Detected suspicious browser' }.to_json if record.data.nil? re...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/models/concerns/encryptable.rb
app/models/concerns/encryptable.rb
# frozen_string_literal: true module Encryptable extend ActiveSupport::Concern class_methods do def attr_encrypted(*attributes) attributes.each do |attribute| define_method("#{attribute}=".to_sym) do |value| return if value.nil? self.public_send( "#{attribute}_en...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/models/concerns/data_is_json_validator.rb
app/models/concerns/data_is_json_validator.rb
# frozen_string_literal: true # Data json validation class DataIsJsonValidator < ActiveModel::EachValidator def validate_each(record, attribute, data) return if data.nil? unless validate_data_is_json!(data) record.errors.add(attribute, :invalid_format, message: 'data is not json compatible string') ...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/base.rb
app/api/base.rb
module API class Base < Grape::API PREFIX = '/api' cascade false mount API::V2::Base => API::V2::Base::API_VERSION end end
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/exception_handlers.rb
app/api/v2/exception_handlers.rb
# encoding: UTF-8 # frozen_string_literal: true module API module V2 # Overrides standard AR and grape validation errors module ExceptionHandlers def self.included(base) base.instance_eval do rescue_from Grape::Exceptions::ValidationErrors do |e| errors_array = e.full_mess...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/utils.rb
app/api/v2/utils.rb
# frozen_string_literal: true module API::V2 module Utils def remote_ip # default behaviour, IP from HTTP_X_FORWARDED_FOR ip = env['action_dispatch.remote_ip'].to_s if Barong::App.config.gateway == 'akamai' # custom header that contains only client IP true_client_ip = request.e...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/validations.rb
app/api/v2/validations.rb
# frozen_string_literal: true module API module V2 module Validations class AllowBlankValidator < Grape::Validations::AllowBlankValidator # Default exception is costructed from `@api` class name. # E.g # @api.base.name => API::V2::Account::Withdraws # default_message => "a...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/base.rb
app/api/v2/base.rb
# frozen_string_literal: true require_dependency 'v2/validations' require_dependency 'v2/exception_handlers' module API::V2 # Base api configuration for V2 module class Base < Grape::API API_VERSION = 'v2' cascade false logger Rails.logger.dup if Rails.env.production? logger.formatter = Gr...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/named_params.rb
app/api/v2/named_params.rb
# frozen_string_literal: true module API module V2 module NamedParams extend ::Grape::API::Helpers params :pagination_filters do optional :page, type: { value: Integer, message: 'non_integer_page' }, values: { value: -> (p){ p.try(:positive?) }, message: 'non_positive_pag...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/management/documents.rb
app/api/v2/management/documents.rb
# frozen_string_literal: true module API::V2 module Management # Documents server-to-server API class Documents < Grape::API desc 'Documents related routes' resource :documents do helpers do def parse_file_data(upload, name, ext) decoded_file = Base64.strict_decode64...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/management/users.rb
app/api/v2/management/users.rb
# frozen_string_literal: true module API::V2 module Management class Users < Grape::API helpers ::API::V2::NamedParams helpers do def profile_param_keys %w[first_name last_name dob address postcode city country state].freeze end def create_user(user_par...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/management/profiles.rb
app/api/v2/management/profiles.rb
# frozen_string_literal: true module API::V2 module Management # Profiles server-to-server API class Profiles < Grape::API desc 'Profiles related routes' resource :profiles do helpers do def profile_param_keys %w[first_name last_name dob address postco...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/management/tools.rb
app/api/v2/management/tools.rb
# frozen_string_literal: true module API::V2 module Management class Tools < Grape::API desc 'Returns server time in seconds since Unix epoch.' do @settings[:scope] = :tools end post '/timestamp' do body timestamp: Time.now.to_i status 200 end end end end
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/management/otp.rb
app/api/v2/management/otp.rb
# frozen_string_literal: true module API module V2 module Management class Otp < Grape::API helpers do def sign_request(jwt) JWT::Multisig.add_jws(jwt, :barong, Barong::App.config.keystore.private_key, 'RS256') rescue StandardError => e error!("JWT is inv...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/management/phones.rb
app/api/v2/management/phones.rb
# frozen_string_literal: true module API::V2 module Management class Phones < Grape::API helpers do def validate_phone!(phone_number) error!('management.phone.invalid_num', 400) unless Phone.valid?(phone_number) error!('management.phone.number_exist', 400) if Phone.verified.find...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/management/base.rb
app/api/v2/management/base.rb
module API::V2 module Management class Base < Grape::API PREFIX = '/management' do_not_route_options! rescue_from(API::V2::Management::Exceptions::Base) { |e| error!(e.message, e.status, e.headers) } rescue_from(Grape::Exceptions::ValidationErrors) { |e| error!(e.message, 422) } re...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/management/jwt_authentication_middleware.rb
app/api/v2/management/jwt_authentication_middleware.rb
# frozen_string_literal: true require 'stringio' module API::V2 module Management class JWTAuthenticationMiddleware < Grape::Middleware::Base extend Memoist mattr_accessor :security_configuration def before return if request.path == '/api/v2/management/swagger' check_request_...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/management/api_keys.rb
app/api/v2/management/api_keys.rb
# frozen_string_literal: true module API::V2 module Management class APIKeys < Grape::API resource :api_keys do desc 'Create an api key for service account' do @settings[:scope] = :write_apikeys success API::V2::Entities::APIKey end params do requires :...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/management/service_accounts.rb
app/api/v2/management/service_accounts.rb
# frozen_string_literal: true module API::V2 module Management # ServiceAccounts server-to-server API class ServiceAccounts < Grape::API helpers ::API::V2::NamedParams desc 'ServiceAccounts related routes' resource :service_accounts do desc 'Get specific service_account informatio...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/management/labels.rb
app/api/v2/management/labels.rb
# frozen_string_literal: true module API::V2 module Management # Labels-related API class Labels < Grape::API helpers ::API::V2::NamedParams helpers do def user @user ||= User.find_by!(uid: params[:user_uid]) end def permitted_search_params(params) pa...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/management/exceptions/authentication.rb
app/api/v2/management/exceptions/authentication.rb
# frozen_string_literal: true module API::V2 module Management module Exceptions class Authentication < Base def status @options.fetch(:status, 401) end end end end end
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/management/exceptions/base.rb
app/api/v2/management/exceptions/base.rb
# frozen_string_literal: true module API::V2 module Management module Exceptions class Base < StandardError def initialize(message:, **options) @options = options super(message) end def headers @options.fetch(:headers, {}) end def stat...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/management/entities/user_with_kyc.rb
app/api/v2/management/entities/user_with_kyc.rb
# frozen_string_literal: true module API::V2::Management module Entities class UserWithKYC < API::V2::Entities::UserWithKYC expose :profiles, using: Entities::Profile expose :phones, using: Entities::Phone expose :documents, using: Entities::Document end end end
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/management/entities/user_with_profile.rb
app/api/v2/management/entities/user_with_profile.rb
# frozen_string_literal: true module API::V2::Management module Entities class UserWithProfile < API::V2::Entities::UserWithProfile expose :profiles, using: Entities::Profile end end end
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/management/entities/profile.rb
app/api/v2/management/entities/profile.rb
# frozen_string_literal: true module API::V2::Management module Entities class Profile < API::V2::Entities::Profile expose :last_name, documentation: { type: 'String', desc: 'Last name' } expose :dob, documentation: { t...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/management/entities/phone.rb
app/api/v2/management/entities/phone.rb
# frozen_string_literal: true module API::V2::Management module Entities class Phone < API::V2::Entities::Phone expose :number, documentation: { type: 'String', desc: 'Phone Number' } end end end
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/management/entities/document.rb
app/api/v2/management/entities/document.rb
# frozen_string_literal: true module API::V2::Management module Entities class Document < API::V2::Entities::Document expose :doc_number, documentation: { type: 'String', desc: 'Document number: AB123123 type' } end end end
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/resource/documents.rb
app/api/v2/resource/documents.rb
# frozen_string_literal: true module API::V2 module Resource # Dpcuments API class Documents < Grape::API desc 'Documents related routes' resource :documents do desc 'Return current user documents list', failure: [ { code: 401, message: 'Invalid bearer token' } ...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/resource/users.rb
app/api/v2/resource/users.rb
# frozen_string_literal: true module API::V2 module Resource class Users < Grape::API helpers ::API::V2::NamedParams helpers do def password_error!(options = {}) options[:topic] = 'password' record_error!(options) end def validate_topic!(topic) u...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/resource/profiles.rb
app/api/v2/resource/profiles.rb
# frozen_string_literal: true module API::V2 module Resource # CR functionality over profiles table class Profiles < Grape::API helpers do def profile_param_keys %w[first_name last_name dob address postcode city country metadata].freeze end end desc '...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/resource/otp.rb
app/api/v2/resource/otp.rb
# frozen_string_literal: true module API::V2 module Resource # TOTP functionality API class Otp < Grape::API helpers do def otp_error!(options = {}) options[:topic] = 'otp' record_error!(options) end end resource :otp do desc 'Generate qr code fo...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/resource/data_storage.rb
app/api/v2/resource/data_storage.rb
# frozen_string_literal: true module API module V2 module Resource # data storage C functionality class DataStorage < Grape::API resource :data_storage do desc 'Create data storage', failure: [ { code: 401, message: 'Invalid bearer token' }, {...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/resource/utils.rb
app/api/v2/resource/utils.rb
# frozen_string_literal: true module API::V2 module Resource module Utils def current_user if env[:current_payload].has_key?(:uid) @_current_user ||= User.find_by!(uid: env[:current_payload][:uid]) else raise(Peatio::Auth::Error, 'Middleware Error') end end...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/resource/phones.rb
app/api/v2/resource/phones.rb
# frozen_string_literal: true module API::V2 module Resource class Phones < Grape::API rescue_from(Twilio::REST::RestError) do |error| Rails.logger.error "Twilio Client Error: #{error.message}" error!({ errors: [twilio_dictionary_error(error.code)] }, 422) end helpers do ...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/resource/addresses.rb
app/api/v2/resource/addresses.rb
# frozen_string_literal: true module API::V2 module Resource # Addresses API class Addresses < Grape::API desc 'Documents related routes' resource :addresses do desc 'Upload a new address approval document for current user', success: { code: 201, message: 'New address approval d...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/resource/base.rb
app/api/v2/resource/base.rb
# frozen_string_literal: true require_dependency 'barong/middleware/jwt_authenticator' module API::V2 module Resource class Base < Grape::API use Barong::Middleware::JWTAuthenticator, \ pubkey: Rails.configuration.x.keystore.public_key helpers API::V2::Resource::Utils do_not_route_op...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/resource/api_keys.rb
app/api/v2/resource/api_keys.rb
# frozen_string_literal: true module API::V2 module Resource # Responsible for CRUD for api keys class APIKeys < Grape::API helpers ::API::V2::NamedParams helpers do def otp_protected! unless current_user.otp error!({ errors: ['resource.api_key.2fa_disabled'] }, 400)...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/resource/service_accounts.rb
app/api/v2/resource/service_accounts.rb
# frozen_string_literal: true module API::V2 module Resource class ServiceAccounts < Grape::API helpers ::API::V2::NamedParams helpers do def otp_protected! unless current_user.otp error!({ errors: ['resource.service_accounts.2fa_disabled'] }, 400) end ...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/resource/labels.rb
app/api/v2/resource/labels.rb
# frozen_string_literal: true module API module V2 module Resource # Responsible for CRUD for labes class Labels < Grape::API resource :labels do desc 'List all labels for current user.', failure: [ { code: 401, message: 'Invalid bearer token' } ...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/entities/restriction.rb
app/api/v2/entities/restriction.rb
# frozen_string_literal: true module API::V2 module Entities class Restriction < API::V2::Entities::Base expose :id, documentation: { type: 'Integer', desc: 'Restriction id' } expose :category, documentation: { type: 'String', de...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/entities/permission.rb
app/api/v2/entities/permission.rb
# frozen_string_literal: true module API module V2 module Entities class Permission < API::V2::Entities::Base expose :id, documentation: { type: 'Integer', desc: 'Permission id' } expose :action, documentation: ...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/entities/admin_label_view.rb
app/api/v2/entities/admin_label_view.rb
# frozen_string_literal: true module API::V2 module Entities class AdminLabelView < API::V2::Entities::Base expose :key, documentation: { type: 'String', desc: 'Label key. [a-z0-9_-]+ should be used. Min - 3, max - 255 characters.' } expose :valu...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/entities/user_with_full_info.rb
app/api/v2/entities/user_with_full_info.rb
# frozen_string_literal: true module API module V2 module Entities # User information containing profile, labels and documents class UserWithFullInfo < API::V2::Entities::Base expose :email, documentation: { type: 'String', desc: 'User Email' ...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/entities/data_storage.rb
app/api/v2/entities/data_storage.rb
# frozen_string_literal: true module API module V2 module Entities # data storage retrieval entity class DataStorage < API::V2::Entities::Base expose :title, documentation: { type: 'String', desc: 'Any additional data title' } ...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/entities/user_with_kyc.rb
app/api/v2/entities/user_with_kyc.rb
# frozen_string_literal: true module API module V2 module Entities # User information containing profile, labels and documents class UserWithKYC < API::V2::Entities::Base expose :email, documentation: { type: 'String', desc: 'User Email' ...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/entities/user_with_profile.rb
app/api/v2/entities/user_with_profile.rb
# frozen_string_literal: true module API::V2 module Entities class UserWithProfile < API::V2::Entities::Base expose :email, documentation: { type: 'String', desc: 'User Email' } expose :uid, documentation: { type: 'Stri...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false
openware/barong
https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/entities/comment.rb
app/api/v2/entities/comment.rb
# frozen_string_literal: true module API module V2 module Entities # comment retrieval entity class Comment < API::V2::Entities::Base expose :id, documentation: { type: 'Integer', desc: 'Comment id' } expose :author_uid, ...
ruby
Apache-2.0
1f488179596f8aa3ac2528f78f0d9f330f45be2b
2026-01-04T17:41:13.346865Z
false