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 |
|---|---|---|---|---|---|---|---|---|
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/entities/base.rb | app/api/v2/entities/base.rb | # encoding: UTF-8
# frozen_string_literal: true
module API
module V2
module Entities
class Base < Grape::Entity
format_with(:iso_timestamp) { |t| t.iso8601 if t }
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/entities/activity.rb | app/api/v2/entities/activity.rb | # frozen_string_literal: true
module API::V2
module Entities
class Activity < API::V2::Entities::Base
expose :id,
documentation: {
type: 'Integer',
desc: 'Activity ID'
}
expose :user_ip,
documentation: {
type: 'String',... | 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/profile.rb | app/api/v2/entities/profile.rb | # frozen_string_literal: true
module API::V2
module Entities
class Profile < API::V2::Entities::Base
expose :first_name,
documentation: {
type: 'String',
desc: 'First Name'
}
expose :last_name,
documentation: {
type: 'S... | 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/level.rb | app/api/v2/entities/level.rb | # frozen_string_literal: true
module API
module V2
module Entities
class Level < API::V2::Entities::Base
expose :id,
documentation: {
type: 'Integer',
desc: 'Level identifier, level number'
}
expose :key,
document... | 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/phone.rb | app/api/v2/entities/phone.rb | # frozen_string_literal: true
module API
module V2
module Entities
# Phone request response
class Phone < API::V2::Entities::Base
expose :country,
documentation: {
type: 'String',
desc: 'Phone country'
}
expose :number,
... | 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/api_key.rb | app/api/v2/entities/api_key.rb | # frozen_string_literal: true
module API::V2
module Entities
class APIKey < API::V2::Entities::Base
expose :kid,
documentation: {
type: 'String',
desc: 'JWT public key'
}
expose :algorithm,
documentation: {
type: 'Strin... | 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/service_accounts.rb | app/api/v2/entities/service_accounts.rb | # frozen_string_literal: true
module API::V2
module Entities
class ServiceAccounts < 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/document.rb | app/api/v2/entities/document.rb | # frozen_string_literal: true
module API
module V2
module Entities
# Return user document with related info
class Document < API::V2::Entities::Base
expose :upload,
documentation: {
type: 'String',
desc: 'File url'
}
expos... | 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/label.rb | app/api/v2/entities/label.rb | # frozen_string_literal: true
module API::V2
module Entities
class Label < API::V2::Entities::Base
expose :key,
documentation: {
type: 'String',
desc: 'Label key. [a-z0-9_-]+ should be used. Min - 3, max - 255 characters.'
}
expose :value,
... | 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.rb | app/api/v2/entities/user.rb | # frozen_string_literal: true
module API
module V2
module Entities
# Basic user info
class User < API::V2::Entities::Base
expose :email,
documentation: {
type: 'String',
desc: 'User Email'
}
expose :uid,
docu... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/admin/abilities.rb | app/api/v2/admin/abilities.rb | # frozen_string_literal: true
module API
module V2
module Admin
# Admin functionality over abilities
class Abilities < Grape::API
namespace :abilities do
desc 'Get all roles and admin_permissions of barong cancan.'
get do
Ability.admin_permissions[current_user.... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/admin/users.rb | app/api/v2/admin/users.rb | # frozen_string_literal: true
module API
module V2
module Admin
# Admin functionality over users table
class Users < Grape::API
resource :users do
helpers ::API::V2::NamedParams
helpers do
def permitted_search_params(params)
params.slice(:uid, :em... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/admin/profiles.rb | app/api/v2/admin/profiles.rb | # frozen_string_literal: true
module API
module V2
module Admin
# Admin functionality over profiles table
class Profiles < Grape::API
resource :profiles do
helpers ::API::V2::NamedParams
desc 'Return all profiles',
failure: [
{ code: 401, messa... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/admin/restrictions.rb | app/api/v2/admin/restrictions.rb | # frozen_string_literal: true
module API
module V2
module Admin
# Admin functionality over restrictions table
class Restrictions < Grape::API
resource :restrictions do
helpers ::API::V2::NamedParams
desc 'Returns array of restrictions as a paginated collection',
... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/admin/base.rb | app/api/v2/admin/base.rb | # frozen_string_literal: true
require_dependency 'barong/middleware/jwt_authenticator'
module API::V2
module Admin
class Base < Grape::API
PREFIX = '/admin'
use Barong::Middleware::JWTAuthenticator, \
pubkey: Rails.configuration.x.keystore.public_key
cascade false
format ... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/admin/permissions.rb | app/api/v2/admin/permissions.rb | # frozen_string_literal: true
module API
module V2
module Admin
# Admin functionality over permissions table
class Permissions < Grape::API
resource :permissions do
helpers ::API::V2::NamedParams
helpers do
def validate_params!(params)
unless %w(g... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/admin/api_keys.rb | app/api/v2/admin/api_keys.rb | # frozen_string_literal: true
module API
module V2
module Admin
# Admin functionality over user api keys
class APIKeys < Grape::API
resource :api_keys do
helpers ::API::V2::NamedParams
helpers ::API::V2::Admin::NamedParams
desc 'List all api keys for selected ac... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/admin/named_params.rb | app/api/v2/admin/named_params.rb | # frozen_string_literal: true
module API
module V2
module Admin
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?) ... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/admin/levels.rb | app/api/v2/admin/levels.rb | # frozen_string_literal: true
module API
module V2
module Admin
# Admin functionality over levels table
class Levels < Grape::API
resource :levels do
desc 'Returns array of permissions as paginated collection',
failure: [
{ code: 401, message: 'Invalid bear... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/admin/metrics.rb | app/api/v2/admin/metrics.rb | # frozen_string_literal: true
module API
module V2
module Admin
# Metrics functionality
class Metrics < Grape::API
helpers do
def permitted_search_params(params)
params.slice(:created_from, :created_to, :topic, :action, :result).merge(with_user: false)
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/admin/activities.rb | app/api/v2/admin/activities.rb | # frozen_string_literal: true
module API
module V2
module Admin
# Admin functionality over activities table
class Activities < Grape::API
resource :activities do
helpers ::API::V2::NamedParams
helpers ::API::V2::Admin::NamedParams
helpers do
def permi... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/admin/entities/admin_activity.rb | app/api/v2/admin/entities/admin_activity.rb | # frozen_string_literal: true
module API::V2::Admin
module Entities
class AdminActivity < API::V2::Entities::Base
expose :user_ip,
documentation: {
type: 'String',
desc: 'User IP'
}
expose :user_ip_country,
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/admin/entities/user_with_kyc.rb | app/api/v2/admin/entities/user_with_kyc.rb | # frozen_string_literal: true
module API::V2::Admin
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/admin/entities/activity_with_user.rb | app/api/v2/admin/entities/activity_with_user.rb | # frozen_string_literal: true
module API::V2::Admin
module Entities
class ActivityWithUser < API::V2::Entities::Base
expose :user_ip,
documentation: {
type: 'String',
desc: 'User IP'
}
expose :user_ip_country,
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/admin/entities/user_with_profile.rb | app/api/v2/admin/entities/user_with_profile.rb | # frozen_string_literal: true
module API::V2::Admin
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/admin/entities/profile.rb | app/api/v2/admin/entities/profile.rb | # frozen_string_literal: true
module API::V2::Admin
module Entities
class Profile < API::V2::Entities::Profile
expose :last_name,
documentation: {
type: 'String',
desc: 'Last name'
}
expose :dob,
documentation: {
type: ... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/admin/entities/phone.rb | app/api/v2/admin/entities/phone.rb | # frozen_string_literal: true
module API::V2::Admin
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/admin/entities/document.rb | app/api/v2/admin/entities/document.rb | # frozen_string_literal: true
module API::V2
module Admin
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/public/base.rb | app/api/v2/public/base.rb | # frozen_string_literal: true
module API
module V2
module Public
class Base < Grape::API
helpers API::V2::Identity::Utils
do_not_route_options!
mount Public::General
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/public/general.rb | app/api/v2/public/general.rb | # frozen_string_literal: true
module API::V2
module Public
class General < Grape::API
desc 'KYC callback'
post '/kyc' do
return_status = KycService.kycaid_callback(params)
status return_status
end
desc 'Password strength testing'
params do
requires :passwor... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/queries/activity_filter.rb | app/api/v2/queries/activity_filter.rb | # frozen_string_literal: true
# queries helping module
module API::V2::Queries
class ActivityFilter
attr_accessor :initial_scope
# initialize query
def initialize(initial_scope)
@initial_scope = initial_scope
end
# returns query with with all applied filters
def call(params)
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/queries/user_with_label_filter.rb | app/api/v2/queries/user_with_label_filter.rb | # queries helping module
module API::V2::Queries
class UserWithLabelFilter
attr_accessor :initial_scope
# initialize query to get User.all
def initialize(initial_scope)
@initial_scope = initial_scope.left_outer_joins(:labels)
end
# returns query with with all applied filters
def call(p... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/queries/user_filter.rb | app/api/v2/queries/user_filter.rb | # queries helping module
module API::V2::Queries
class UserFilter
attr_accessor :initial_scope
# initialize query to get User.all
def initialize(initial_scope)
@initial_scope = initial_scope.left_outer_joins(:profiles)
end
# returns query with with all applied filters
def call(params)
... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/identity/users.rb | app/api/v2/identity/users.rb | # frozen_string_literal: true
require_dependency 'barong/jwt'
module API::V2
module Identity
class Users < Grape::API
helpers do
def parse_refid!
error!({ errors: ['identity.user.invalid_referral_format'] }, 422) unless params[:refid].start_with?(Barong::App.config.uid_prefix.upcase)
... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/identity/sessions.rb | app/api/v2/identity/sessions.rb | # frozen_string_literal: true
require_dependency 'barong/jwt'
module API::V2
module Identity
class Sessions < Grape::API
helpers do
def get_user(email)
user = User.find_by(email: email)
error!({ errors: ['identity.session.invalid_params'] }, 401) unless user
if user.... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/identity/utils.rb | app/api/v2/identity/utils.rb | # frozen_string_literal: true
module API::V2
module Identity
module Utils
def session
request.session
end
def codec
@_codec ||= Barong::JWT.new(key: Barong::App.config.keystore.private_key)
end
def open_session(user)
csrf_token = SecureRandom.hex(10)
... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/identity/base.rb | app/api/v2/identity/base.rb | # frozen_string_literal: true
module API
module V2
module Identity
# base api configurations for module
class Base < Grape::API
helpers API::V2::Identity::Utils
do_not_route_options!
mount Identity::General
mount Identity::Sessions
mount Identity::Users
... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/api/v2/identity/general.rb | app/api/v2/identity/general.rb | # frozen_string_literal: true
module API::V2
module Identity
class General < Grape::API
desc 'Password strength testing'
params do
requires :password, type: String, desc: 'User password'
end
post '/password/validate' do
{ entropy: PasswordStrengthChecker.calculate_entropy(... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/mailers/postmaster.rb | app/mailers/postmaster.rb | # frozen_string_literal: true
class Postmaster < ApplicationMailer
layout 'mailer'
def process_payload(params)
@record = params[:record]
@changes = params[:changes]
@user = params[:user]
@logo = params[:logo]
sender = "#{Barong::App.config.sender_name} <#{Barong::App.config.sender_emai... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/mailers/application_mailer.rb | app/mailers/application_mailer.rb | # frozen_string_literal: true
class ApplicationMailer < ActionMailer::Base
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/channels/application_cable/channel.rb | app/channels/application_cable/channel.rb | module ApplicationCable
class Channel < ActionCable::Channel::Base
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/app/channels/application_cable/connection.rb | app/channels/application_cable/connection.rb | module ApplicationCable
class Connection < ActionCable::Connection::Base
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/db/seeds.rb | db/seeds.rb | # frozen_string_literal: true
require_dependency 'barong/seed'
seed = Barong::Seed.new
seed.seed_levels
seed.seed_permissions
seed.seed_users
seed.seed_restrictions
puts seed.inspect
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/db/schema.rb | db/schema.rb | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# dat... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/db/migrate/20200929143711_add_encrypted_values_to_phones_profiles_documents.rb | db/migrate/20200929143711_add_encrypted_values_to_phones_profiles_documents.rb | class AddEncryptedValuesToPhonesProfilesDocuments < ActiveRecord::Migration[5.2]
def up
# Phones Table
add_column :phones, :number_encrypted, :string, null: false, after: :code
add_column :phones, :number_index, :bigint, null: false, after: :number_encrypted
add_index :phones, [:number_index]
# E... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/db/migrate/20190529114214_changes_in_activities_table.rb | db/migrate/20190529114214_changes_in_activities_table.rb | class ChangesInActivitiesTable < ActiveRecord::Migration[5.2]
def change
add_column :activities, :target_uid, :string, after: :user_id
add_column :activities, :category, :string, after: :target_uid
add_column :permissions, :topic, :string, after: :path
add_index :activities, :target_uid
add_index... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/db/migrate/20190902032709_add_state_profiles.rb | db/migrate/20190902032709_add_state_profiles.rb | class AddStateProfiles < ActiveRecord::Migration[5.2]
def change
add_column :profiles, :state, :integer, unsigned: true, limit: 1, after: :country
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/db/migrate/20191210090006_add_description_to_labels.rb | db/migrate/20191210090006_add_description_to_labels.rb | class AddDescriptionToLabels < ActiveRecord::Migration[5.2]
def change
add_column :labels, :description, :string, null: true, after: :scope
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/db/migrate/20181115100105_create_activities.rb | db/migrate/20181115100105_create_activities.rb | class CreateActivities < ActiveRecord::Migration[5.2]
def change
create_table :activities do |t|
t.references :user, null: false
t.string :user_ip, null: false
t.string :user_agent, null: false
t.string :topic, null: false
t.string :action, null: fal... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/db/migrate/20190318133453_create_permissions.rb | db/migrate/20190318133453_create_permissions.rb | class CreatePermissions < ActiveRecord::Migration[5.2]
def change
create_table :permissions do |t|
t.string :action, null: false
t.string :role, null: false
t.string :verb, null: false
t.string :path, null: false
t.timestamps
end
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/db/migrate/20190827080317_add_data_field_to_users_table.rb | db/migrate/20190827080317_add_data_field_to_users_table.rb | class AddDataFieldToUsersTable < ActiveRecord::Migration[5.2]
def change
add_column :users, :data, :text, null: true, after: :role
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/db/migrate/20200514123908_add_identificator_to_documents_table.rb | db/migrate/20200514123908_add_identificator_to_documents_table.rb | class AddIdentificatorToDocumentsTable < ActiveRecord::Migration[5.2]
def change
add_column :documents, :identificator, :string, after: :doc_expire
add_column :documents, :doc_issue, :date, before: :doc_expire
add_column :profiles, :applicant_id, :string, after: :user_id
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/db/migrate/20200429082843_add_code_and_type_in_restrictions_table.rb | db/migrate/20200429082843_add_code_and_type_in_restrictions_table.rb | class AddCodeAndTypeInRestrictionsTable < ActiveRecord::Migration[5.2]
def change
add_column :restrictions, :code, :integer, null: true, after: :value
add_column :restrictions, :category, :string, null: false, after: :id
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/db/migrate/20210316083841_add_username_to_users.rb | db/migrate/20210316083841_add_username_to_users.rb | class AddUsernameToUsers < ActiveRecord::Migration[5.2]
def change
add_column :users, :username, :string, after: :uid
add_index :users, :username, unique: true, where: 'username IS NOT NULL'
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/db/migrate/20190108115333_add_referral_id_to_users_table.rb | db/migrate/20190108115333_add_referral_id_to_users_table.rb | # frozen_string_literal: true
# Add new field due to referral - affiliate relation
class AddReferralIdToUsersTable < ActiveRecord::Migration[5.2]
def change
add_column :users, :referral_id, :bigint, after: :state
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/db/migrate/20201001112814_change_document_fields_position.rb | db/migrate/20201001112814_change_document_fields_position.rb | class ChangeDocumentFieldsPosition < ActiveRecord::Migration[5.2]
def up
change_column :documents, :doc_issue, :date, after: :doc_number_index
change_column :documents, :doc_category, :string, after: :doc_issue
end
def down
change_column :documents, :doc_issue, :date, after: :updated_at
change_co... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/db/migrate/20210325133233_add_unique_index_on_labels.rb | db/migrate/20210325133233_add_unique_index_on_labels.rb | class AddUniqueIndexOnLabels < ActiveRecord::Migration[5.2]
def change
remove_index :labels, [:user_id, :key, :scope]
# Delete duplicated values
ids = ActiveRecord::Base.connection.execute("SELECT MAX(ID) from labels l GROUP BY l.user_id, l.scope, l.key")
Label.where.not(id: ids.to_a.flatten).find_e... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/db/migrate/20200701115721_add_doc_category_to_documents.rb | db/migrate/20200701115721_add_doc_category_to_documents.rb | class AddDocCategoryToDocuments < ActiveRecord::Migration[5.2]
def change
add_column :documents, :doc_category, :string
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/db/migrate/20191122151630_create_data_storages.rb | db/migrate/20191122151630_create_data_storages.rb | class CreateDataStorages < ActiveRecord::Migration[5.2]
def change
create_table :data_storages do |t|
t.bigint :user_id, null: false, unsigned: true
t.string :title, limit: 64, null: false
t.text :data, limit: 5120, null: false
t.timestamps
t.index [:user_id, :title], unique: true
... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/db/migrate/20181101143041_create_all_tables.rb | db/migrate/20181101143041_create_all_tables.rb | class CreateAllTables < ActiveRecord::Migration[5.2]
def change
create_table :users do |t|
t.string :uid, null: false
t.string :email, null: false
t.string :password_digest, null: false
t.string :role, default: "member", null: f... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/db/migrate/20200318152130_add_default_state_to_profiles_table.rb | db/migrate/20200318152130_add_default_state_to_profiles_table.rb | class AddDefaultStateToProfilesTable < ActiveRecord::Migration[5.2]
def change
change_column_default :profiles, :state, 'drafted'
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/db/migrate/20200609144734_create_comments.rb | db/migrate/20200609144734_create_comments.rb | class CreateComments < ActiveRecord::Migration[5.2]
def change
create_table :comments do |t|
t.bigint :user_id, null: false, unsigned: true
t.string :author_uid, limit: 16, null: false
t.string :title, limit: 64, null: false
t.text :data, limit: 5120, null: false
t.timestamps
... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/db/migrate/20210407094208_add_user_ip_country_field_to_activities.rb | db/migrate/20210407094208_add_user_ip_country_field_to_activities.rb | class AddUserIpCountryFieldToActivities < ActiveRecord::Migration[5.2]
def change
add_column :activities, :user_ip_country, :string, after: :user_ip
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/db/migrate/20200902125225_make_api_key_kid_unique.rb | db/migrate/20200902125225_make_api_key_kid_unique.rb | class MakeApiKeyKidUnique < ActiveRecord::Migration[5.2]
class APIKey < ActiveRecord::Base
self.table_name = :apikeys
end
def up
duplicated_records = APIKey.select(:kid).group(:kid).having("count(*) > 1")
duplicated_records.each do |api_key|
APIKey.where(kid: api_key.kid).destroy_all
end
... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/db/migrate/20200507104423_add_encrypted_secret.rb | db/migrate/20200507104423_add_encrypted_secret.rb | class AddEncryptedSecret < ActiveRecord::Migration[5.2]
def change
add_column :apikeys, :secret_encrypted, :string, limit: 1024, after: :scope
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/db/migrate/20200602075906_add_author_to_profiles.rb | db/migrate/20200602075906_add_author_to_profiles.rb | class AddAuthorToProfiles < ActiveRecord::Migration[5.2]
def change
add_column :profiles, :author, :string, null: true, after: :user_id
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/db/migrate/20210218135634_change_owner_id_requirement.rb | db/migrate/20210218135634_change_owner_id_requirement.rb | class ChangeOwnerIdRequirement < ActiveRecord::Migration[5.2]
def up
change_column :service_accounts, :owner_id, :bigint, null: true, unsigned: true
end
def down
change_column :service_accounts, :owner_id, :bigint, null: false, unsigned: true
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/db/migrate/20190813112503_create_restrictions.rb | db/migrate/20190813112503_create_restrictions.rb | class CreateRestrictions < ActiveRecord::Migration[5.2]
def change
create_table :restrictions do |t|
t.string :scope, limit: 64, null: false
t.string :value, limit: 64, null: false
t.string :state, limit: 16, default: 'enabled', null: false
t.timestamps
end
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/db/migrate/20200904153034_add_service_accounts_and_related_changes.rb | db/migrate/20200904153034_add_service_accounts_and_related_changes.rb | class AddServiceAccountsAndRelatedChanges < ActiveRecord::Migration[5.2]
class APIKey < ActiveRecord::Base
self.table_name = :apikeys
end
def up
create_table :service_accounts do |t|
t.string :uid, null: false
t.bigint :owner_id, null: false, unsigned: true
... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/test/application_system_test_case.rb | test/application_system_test_case.rb | require "test_helper"
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/test/test_helper.rb | test/test_helper.rb | ENV['RAILS_ENV'] ||= 'test'
require_relative '../config/environment'
require 'rails/test_help'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
# Add more helper methods to be used by all tests here...
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/rails_helper.rb | spec/rails_helper.rb | # This file is copied to spec/ when you run 'rails generate rspec:install'
require 'spec_helper'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Ra... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
require 'rails_helper'
require_dependency 'barong/jwt'
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper`... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/initializers/document_types.spec.rb | spec/initializers/document_types.spec.rb | # frozen_string_literal: true
require 'rails_helper'
describe 'Document Types configuraton class' do
context 'testing list function' do
let(:expected_values) { ['Passport', 'Identity card', 'Driver license', 'Utility Bill', 'Residental', 'Institutional'] }
before do
@template = { 'document_types' => ... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/initializers/data_storage_titles_spec.rb | spec/initializers/data_storage_titles_spec.rb | # frozen_string_literal: true
require 'rails_helper'
describe 'Data Storage Titles configuraton class' do
context 'testing list function' do
let(:expected_values) { ['personal', 'company'] }
it 'reads configuration from the file' do
expect(UserStorageTitles.list).to eq(expected_values)
end
i... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/services/event_mailer_spec.rb | spec/services/event_mailer_spec.rb | # frozen_string_literal: true
describe EventMailer do
let(:event_mailer) { EventMailer.new('', '', '')}
let(:event) {
{:record=>
{:user=>
{:uid=>"ID8434CD6E8E",
:email=>"admin@barong.io",
:role=>"admin",
:level=>1,
:otp=>false,
:state=>"active",
... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/services/vault_totp_spec.rb | spec/services/vault_totp_spec.rb | # frozen_string_literal: true
describe TOTPService do
let(:uid) { 'uid' }
let(:email) { 'email' }
describe '.with_human_error' do
it 'renders human error when vault is down' do
expect do
described_class.with_human_error do
raise Vault::VaultError, 'Message connection refused message'... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/services/kyc_service_spec.rb | spec/services/kyc_service_spec.rb | # frozen_string_literal: true
describe KycService do
let!(:create_member_permission) do
create :permission,
role: 'member',
verb: 'all'
create :permission,
role: 'member',
verb: 'all',
path: 'tasty_endpoint'
end
let!(:user) { create :user }
contex... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/services/encryption_service_spec.rb | spec/services/encryption_service_spec.rb | # frozen_string_literal: true
describe EncryptionService do
context 'current_salt' do
before(:each) do
EncryptionService.instance_variable_set(:@cache, {})
end
it { expect(EncryptionService.current_salt).to eq Time.now.strftime('%Y%W') }
it do
allow(Time).to receive(:now).and_return(1.w... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/support/geoip_context.rb | spec/support/geoip_context.rb | # frozen_string_literal: true
shared_context 'geoip mock' do
let(:london_ip) { '196.245.163.202' }
let(:tokyo_ip) { '140.227.60.114' }
before do
class DummyReader
def get(ip)
case ip
when '196.245.163.202'
{
'country' => { 'names' => { 'en' => 'United Kingdom' } }... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/support/redis_helper.rb | spec/support/redis_helper.rb | # encoding: UTF-8
# frozen_string_literal: true
module RedisTestHelper
def clear_redis
Rails.cache.redis.flushall
end
end
RSpec.configure { |config| config.include RedisTestHelper }
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/support/bearer_context.rb | spec/support/bearer_context.rb | # frozen_string_literal: true
shared_context 'bearer authentication' do
let(:test_user) { create(:user) }
let(:jwt_token) do
pkey = Rails.application.config.x.keystore.private_key
codec = Barong::JWT.new(key: pkey)
codec.encode(test_user.as_payload)
end
let(:auth_header) { { 'Authorization' => "... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/support/helper.rb | spec/support/helper.rb | # frozen_string_literal: true
module Helper
def to_readable(field)
field.to_s.humanize.downcase
end
end
RSpec.configure { |config| config.include Helper }
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/support/factory_bot.rb | spec/support/factory_bot.rb | # frozen_string_literal: true
RSpec.configure do |config|
config.include FactoryBot::Syntax::Methods
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/support/api_helpers.rb | spec/support/api_helpers.rb | # frozen_string_literal: true
module APIHelpers
extend Memoist
def json_body
JSON.parse(response.body, symbolize_names: true)
end
def expect_status_to_eq(status)
expect_status.to eq status
end
def expect_status
expect(response.status)
end
def expect_body
expect(json_body)
end
d... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/workers/address_worker_spec.rb | spec/workers/address_worker_spec.rb | # frozen_string_literal: true
describe 'KYC::Kycaid::AddressWorker' do
before { allow(Barong::App.config).to receive_messages(kyc_provider: 'kycaid') }
include_context 'bearer authentication'
let!(:create_member_permission) do
create :permission,
role: 'member'
end
let(:user) { create(:user) ... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/workers/verification_worker_spec.rb | spec/workers/verification_worker_spec.rb | # frozen_string_literal: true
describe 'KYC::Kycaid::VerificationWorker' do
before { allow(Barong::App.config).to receive_messages(kyc_provider: 'kycaid') }
include_context 'bearer authentication'
let!(:create_member_permission) do
create :permission,
role: 'member'
end
let(:user) { create(:u... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/workers/applicant_worker_spec.rb | spec/workers/applicant_worker_spec.rb | # frozen_string_literal: true
describe 'KYC::ApplicantWorker' do
include_context 'bearer authentication'
before { allow(Barong::App.config).to receive_messages(kyc_provider: 'kycaid') }
let!(:create_member_permission) do
create :permission,
role: 'member'
end
let(:profile) { create(:profile, ... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/workers/document_worker_spec.rb | spec/workers/document_worker_spec.rb | # frozen_string_literal: true
describe 'KYC::Kycaid::DocumentWorker' do
before { allow(Barong::App.config).to receive_messages(kyc_provider: 'kycaid') }
include_context 'bearer authentication'
let!(:create_member_permission) do
create :permission,
role: 'member'
end
let(:user) { create(:user)... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/factories/restriction.rb | spec/factories/restriction.rb | # frozen_string_literal: true
FactoryBot.define do
factory :restriction do
scope { 'ip_subnet' }
value { '0.0.0.0/0' }
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/factories/permission.rb | spec/factories/permission.rb | # frozen_string_literal: true
FactoryBot.define do
factory :permission do
role { %w[member trader broker admin accountant support technical compliance superadmin] }
path { 'api/v2' }
action { 'ACCEPT' }
verb { %w[get post put delete head patch all] }
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/factories/service_account.rb | spec/factories/service_account.rb | # frozen_string_literal: true
FactoryBot.define do
factory :service_account do
user { FactoryBot.create(:user) }
email { Faker::Internet.email }
uid { UIDGenerator.generate("SI") }
trait :without_user do
user { nil }
end
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/factories/phones.rb | spec/factories/phones.rb | # frozen_string_literal: true
FactoryBot.define do
factory :phone do
number { '12345678911' }
user
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/factories/activity.rb | spec/factories/activity.rb | # frozen_string_literal: true
FactoryBot.define do
factory :activity do
user { FactoryBot.create(:user) }
user_ip { Faker::Internet.ip_v4_address }
user_agent { Faker::Internet.user_agent }
category { %w[admin user].sample }
topic { %w[session password otp account].sample }
action { %w[otp::... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/factories/api_keys.rb | spec/factories/api_keys.rb | # frozen_string_literal: true
FactoryBot.define do
factory :api_key, class: 'APIKey' do
kid { Faker::Crypto.sha256 }
secret { SecureRandom.hex(16) }
scope { %w[trade] }
algorithm { 'HS256' }
trait :with_service_account do
key_holder_account { create(:service_account) }
end
trait :... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/factories/profile.rb | spec/factories/profile.rb | # frozen_string_literal: true
FactoryBot.define do
factory :profile do
user { FactoryBot.create(:user) }
author { }
first_name { Faker::Name.first_name }
last_name { Faker::Name.last_name }
dob { Faker::Date.birthday }
address { Faker::Address.state }
city { Faker::Address.city }
cou... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/factories/level.rb | spec/factories/level.rb | # frozen_string_literal: true
FactoryBot.define do
factory :level do
key { Faker::Hacker.noun }
value { Faker::Hacker.adjective }
description { Faker::Hacker.say_something_smart }
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/factories/document.rb | spec/factories/document.rb | # frozen_string_literal: true
FactoryBot.define do
factory :document do
user
doc_type { 'Passport' }
doc_number { Faker::Code.asin }
doc_expire { Faker::Business.credit_card_expiry_date }
after(:build) do |doc|
doc.upload.download!(Faker::Company.logo)
end
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/factories/label.rb | spec/factories/label.rb | # frozen_string_literal: true
FactoryBot.define do
factory :label do
key { ::Faker::Internet.slug(glue: '-') }
value { ::Faker::Internet.slug(glue: '-') }
scope { 'public' }
user { create(:user) }
end
end
| ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
openware/barong | https://github.com/openware/barong/blob/1f488179596f8aa3ac2528f78f0d9f330f45be2b/spec/factories/user.rb | spec/factories/user.rb | # frozen_string_literal: true
FactoryBot.define do
factory :user do
email { Faker::Internet.email }
password { 'Tecohvi0' }
password_confirmation { 'Tecohvi0' }
state { 'active' }
trait :with_profile do
after(:create) do |user, _|
create(:profile, user: user)
end
end
... | ruby | Apache-2.0 | 1f488179596f8aa3ac2528f78f0d9f330f45be2b | 2026-01-04T17:41:13.346865Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.