Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Remove Contact synchronisation #493

Open
wants to merge 5 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
source 'https://rubygems.org'

gem 'active_model_otp', git: 'https://github.com/heapsource/active_model_otp.git', ref: '6ed9927'
gem 'dav4rack', git: 'https://github.com/csvalpha/dav4rack.git', ref: '8541e53'

gem 'bcrypt', '~> 3.1', '>= 3.1.20'
gem 'bootsnap', '~> 1.18', '>= 1.18.4'
Expand All @@ -10,7 +9,6 @@ gem 'carrierwave-base64', '~> 2.11'
gem 'carrierwave-bombshelter', '~> 0.2', '>= 0.2.2'
gem 'case_transform', '~> 0.2'
gem 'counter_culture', '~> 3.8', '>= 3.8.2'
gem 'dav4rack_ext', '~> 1.0'
gem 'doorkeeper', '~> 5.8', '>= 5.8.1'
gem 'doorkeeper-i18n', '~> 5.2', '>= 5.2.7'
gem 'exifr', '~> 1.4'
Expand Down
26 changes: 0 additions & 26 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
GIT
remote: https://github.com/csvalpha/dav4rack.git
revision: 8541e53876d7a49a1c2d318e698f9dae88439e89
ref: 8541e53
specs:
dav4rack (0.2.11)
addressable (>= 2.8.0)
nokogiri (>= 1.12.5)
rack (>= 2.2.3)
uuidtools (>= 2.1.5)
webrick (>= 1.7.0)

GIT
remote: https://github.com/heapsource/active_model_otp.git
revision: 6ed9927ac2457b3fa7d59931f7758cac209c3b71
Expand Down Expand Up @@ -139,10 +127,6 @@ GEM
crass (1.0.6)
date (3.4.1)
date (3.4.1-java)
dav4rack_ext (1.0.0)
dav4rack
http_router
vcard_parser (~> 0.0.8)
debug_inspector (1.1.0)
diff-lcs (1.5.0)
docile (1.4.0)
Expand Down Expand Up @@ -215,9 +199,6 @@ GEM
http-cookie (1.0.4)
domain_name (~> 0.5)
http-form_data (2.3.0)
http_router (0.11.2)
rack (>= 1.0.0)
url_mount (~> 0.2.1)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
iban-tools (1.2.1)
Expand Down Expand Up @@ -505,20 +486,15 @@ GEM
unf_ext (0.0.8.1-x86-mingw32)
unicode-display_width (2.1.0)
uniform_notifier (1.16.0)
url_mount (0.2.1)
rack
uuidtools (2.2.0)
validates_timeliness (7.0.0)
activemodel (>= 7.0.0, < 8)
timeliness (>= 0.3.10, < 1)
vcard_parser (0.0.9)
vcr (6.1.0)
vpim (24.2.20)
webmock (3.14.0)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
webrick (1.7.0)
websocket-driver (0.7.7)
base64
websocket-extensions (>= 0.1.0)
Expand Down Expand Up @@ -551,8 +527,6 @@ DEPENDENCIES
colorize
consistency_fail
counter_culture (~> 3.8, >= 3.8.2)
dav4rack!
dav4rack_ext (~> 1.0)
doorkeeper (~> 5.8, >= 5.8.1)
doorkeeper-i18n (~> 5.2, >= 5.2.7)
dotenv-rails
Expand Down
9 changes: 1 addition & 8 deletions app/controllers/v1/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class V1::UsersController < V1::ApplicationController # rubocop:disable Metrics/
get_related_resource]
before_action :set_model, only: %i[update archive activate_account
resend_activation_mail generate_otp_secret
activate_otp activate_webdav]
activate_otp]

def update
password = params.dig('data', 'attributes', 'password')
Expand Down Expand Up @@ -77,13 +77,6 @@ def activate_otp
head :no_content
end

def activate_webdav
authorize @model
@model.generate_webdav_secret_key
@model.save
head :no_content
end

def nextcloud
render json: { id: current_user.id,
displayName: current_user.full_name,
Expand Down
5 changes: 0 additions & 5 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class User < ApplicationRecord # rubocop:disable Metrics/ClassLength
after_commit :sync_mail_aliases

scope :activated, (-> { where('activated_at < ?', Time.zone.now) })
scope :contactsync_users, (-> { where.not(webdav_secret_key: nil) })
scope :tomato_users, (-> { where(allow_tomato_sharing: true) })
scope :login_enabled, (-> { where(login_enabled: true) })
scope :sidekiq_access, (-> { where(sidekiq_access: true) })
Expand Down Expand Up @@ -179,10 +178,6 @@ def self.valid_csv_attributes
column_names.map(&:to_sym) + %i[full_name avatar_url]
end

def generate_webdav_secret_key
self.webdav_secret_key = SecureRandom.hex(32)
end

def to_ical # rubocop:disable Metrics/AbcSize
return unless birthday

Expand Down
46 changes: 0 additions & 46 deletions app/models/webdav/addressbook.rb

This file was deleted.

79 changes: 0 additions & 79 deletions app/models/webdav/contact.rb

This file was deleted.

23 changes: 0 additions & 23 deletions app/models/webdav/user.rb

This file was deleted.

4 changes: 0 additions & 4 deletions app/policies/user_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ def activate_otp?
me?
end

def activate_webdav?
me?
end

def batch_import?
create?
end
Expand Down
4 changes: 2 additions & 2 deletions app/resources/v1/user_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class V1::UserResource < V1::ApplicationResource # rubocop:disable Metrics/Class
:ifes_data_sharing_preference, :info_in_almanak, :almanak_subscription_preference,
:digtus_subscription_preference, :email, :birthday, :address, :postcode, :city,
:phone_number, :food_preferences, :vegetarian, :study, :start_study,
:picture_publication_preference, :ical_secret_key, :webdav_secret_key,
:picture_publication_preference, :ical_secret_key,
:password, :avatar, :avatar_url, :avatar_thumb_url,
:user_details_sharing_preference, :allow_tomato_sharing

Expand Down Expand Up @@ -52,7 +52,7 @@ def fetchable_fields
# Relationships
allowed_keys += %i[groups active_groups memberships mail_aliases mandates
group_mail_aliases permissions photos user_permissions]
allowed_keys += %i[ical_secret_key webdav_secret_key] if me?
allowed_keys += %i[ical_secret_key] if me?
if update_or_me?
allowed_keys += %i[login_enabled otp_required activated_at emergency_contact
emergency_number ifes_data_sharing_preference info_in_almanak
Expand Down
23 changes: 0 additions & 23 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require_relative 'routes/contact_sync_handler'

Rails.application.routes.draw do
scope 'v1' do
use_doorkeeper
Expand Down Expand Up @@ -68,7 +66,6 @@
post :resend_activation_mail
post :generate_otp_secret
post :activate_otp
post :activate_webdav
end
end
get 'users/me/nextcloud', to: 'users#nextcloud'
Expand Down Expand Up @@ -111,26 +108,6 @@
get 'coffee', to: 'coffee#index'
get 'ical/activities', to: 'v1/activities#ical'

namespace :webdav do
match ':user_id/:key/contacts', via: :all, to: ContactSyncHandler.new(
resource_class: DAV4Rack::Carddav::PrincipalResource,
books_collection: '/books/'
)

match ':user_id/:key/contacts/books/', via: :all, to: ContactSyncHandler.new(
resource_class: DAV4Rack::Carddav::AddressbookCollectionResource
)

match ':user_id/:key/contacts/books/:book_id', via: :all, to: ContactSyncHandler.new(
resource_class: DAV4Rack::Carddav::AddressbookResource
)

match ':user_id/:key/contacts/books/:book_id/:contact_id(.vcf)',
via: :all, to: ContactSyncHandler.new(
resource_class: DAV4Rack::Carddav::ContactResource
)
end

require 'sidekiq/web'
require 'sidekiq-scheduler/web'

Expand Down
Loading
Loading