forked from bigbluebutton/greenlight
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
51b762c
commit 001bf21
Showing
28 changed files
with
150 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
app/views/user_mailer/inform_admins_blocked_users_inactivity_email.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<div style="padding-left: 80px; padding-right: 80px;"> | ||
<p style="font-size: 40px; margin-bottom: 20px; font-weight: 600;"><%= t('email.blocked.account_blocked') %></p> | ||
<p style="font-size: 24px;"><%= t('email.blocked.account_blocked_description') %></p> | ||
<p style="font-size: 20px;"><%= t('email.new_user_signup.name', name: @user.name) %></p> | ||
<p style="font-size: 20px;"><%= t('email.new_user_signup.email', email: @user.email) %></p> | ||
</div> |
6 changes: 6 additions & 0 deletions
6
app/views/user_mailer/inform_admins_blocked_users_inactivity_email.text.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
<%= t('email.blocked.account_blocked') %> | ||
<%= t('email.blocked.account_blocked_description') %> | ||
<%= t('email.new_user_signup.name', name: @user.name) %> | ||
<%= t('email.new_user_signup.email', email: @user.email) %> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
#!/bin/sh | ||
echo "[$(date)]" >>/var/log/cron.log 2>&1 | ||
echo "This is a script running every minute" >>/var/log/cron.log 2>&1 | ||
cd /usr/src/app || { | ||
echo "Failed to change directory to /usr/src/app" >>/var/log/cron.log 2>&1 | ||
exit 1 | ||
} | ||
|
||
./bin/rake rooms:delete_expired >>/var/log/cron.log 2>&1 | ||
echo "Finished rake task" >>/var/log/cron.log 2>&1 | ||
echo "Finished rake task delete rooms" >>/var/log/cron.log 2>&1 | ||
./bin/rake users:block_inactive >>/var/log/cron.log 2>&1 | ||
echo "Finished rake task block users" >>/var/log/cron.log 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# frozen_string_literal: true | ||
|
||
namespace :users do | ||
desc 'Block inactive Users' | ||
task block_inactive: :environment do | ||
days = ENV['USER_BLOCK_INACTIVITY'].to_i || 30 | ||
puts "A User is considered inactive if they have not logged in for #{days} days." | ||
inactive_users = User.where('users.status !=2 AND users.last_login < ?', | ||
days.days.ago).or(User.where('users.status !=2 AND users.last_login IS NULL AND users.created_at < ?', | ||
days.days.ago)) | ||
inactive_users = inactive_users.includes(:role).where.not(roles: { name: 'Administrator' }) | ||
if inactive_users.any? | ||
size = inactive_users.size | ||
inactive_users.each do |user| | ||
user.update(status: 2) | ||
user.notify_admins_blocked_users_inactivity | ||
puts "Blocked user: #{user.email}" | ||
rescue StandardError => e | ||
puts "Failed to block #{user.email}: #{e.message}" | ||
end | ||
puts "Blocked #{size} inactive users." | ||
else | ||
puts 'No inactive users to block.' | ||
end | ||
end | ||
end |
Oops, something went wrong.