Page Menu
Home
GRNET
Search
Configure Global Search
Log In
Files
F461272
user_mailer.rb
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, May 18, 12:06 AM
Size
1 KB
Mime Type
text/x-ruby
Expires
Tue, May 20, 12:06 AM (1 d, 42 m)
Engine
blob
Format
Raw Data
Handle
220213
Attached To
rARCHIVING archiving
user_mailer.rb
View Options
class
UserMailer
<
ActionMailer
::
Base
default
from
:
Archiving
.
settings
[
:default_sender
]
# Notifies the host's owners that the host has been verified by an admin
# and is now ready to be configured
#
# @param user_emails[Array] the owners' emails
# @param host[String] the host's FQDN
def
notify_for_verification
(
user_emails
,
host
)
@host
=
host
s
=
"[Archiving] Host
#{
host
.
name
}
verification"
mail
(
to
:
user_emails
,
subject
:
s
)
end
# Notifies the host's owners that the host has been rejected by an admin
#
# @param user_emails[Array] the ownerss emails
# @param host[String] the host's FQDN
# @param reason[String] the rejection reason
def
notify_for_rejection
(
user_emails
,
host
,
reason
)
@host
=
host
@reason
=
reason
s
=
"[Archiving] Host
#{
host
.
name
}
rejection"
mail
(
to
:
user_emails
,
subject
:
s
)
end
# Notifies the user that another user has requested that he should be able to
# manage the given client's backups
#
# @param email[String] the user's email
# @param invitation[Invitation] the target host
def
notify_for_invitation
(
email
,
invitation
)
@invitation
=
invitation
subject
=
"[Archiving] Invitation to manage
#{
@invitation
.
host
.
name
}
's backups"
mail
(
to
:
email
,
subject
:
subject
)
end
# Notifies admins about a new host that needs verification
#
# @param user[User] the user that created the host
# @param host[String] the host's FQDN
def
notify_admin
(
user
,
host
)
admin_emails
=
User
.
admin
.
where
(
enabled
:
true
)
.
pluck
(
:email
)
@user
=
user
@host
=
host
mail
(
to
:
admin_emails
,
subject
:
'New host pending verification'
)
end
end
Event Timeline
Log In to Comment