forked from sakaiproject/sakai
-
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.
SAK-48083 portal: Add push capability to Sakai (sakaiproject#11038)
- Loading branch information
1 parent
131a1fc
commit b3aefc2
Showing
36 changed files
with
913 additions
and
268 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5403,19 +5403,44 @@ | |
# DEFAULT: false | ||
#quartz.seedsites.autorun=true | ||
|
||
# ############################################################### | ||
# SAK-30461 Add academic and social alerts icons to portal topbar | ||
# Set this to false to hide the bullhorn icons in the topbar and | ||
# disable bullhorn event harvesting. | ||
# true/false Defaults to true (on) | ||
# ############################################################### | ||
# Set this to false to hide the bullhorn icon in the topbar and disable bullhorn event harvesting. | ||
# DEFAULT: true | ||
#portal.bullhorns.enabled=false | ||
|
||
# Turn on notifications debugging in the browser console. | ||
# Turn on notifications debugging in the browser console, for both server sent events and push. | ||
# | ||
# DEFAULT: false | ||
#portal.notifications.debug=true | ||
|
||
# Enable push notifications. This has to be enabled for bullhorn alerts - setting this to false will | ||
# effectively halt any bullhorn alerts. When set to true (the default) the browser will request a | ||
# push subscription from the browser vendor's push service, followed by the browser sending those | ||
# details on to the Sakai server. Any PUSH calls to the user messaging service, from then on, will | ||
# make a call to that subscription endpoint and the browser will get a push event. | ||
# DEFAULT: true | ||
# portal.notifications.push.enabled=false | ||
|
||
# To enable push, you need to generate a VAPID keypair. This is the private one. | ||
# | ||
# DEFAULT: sakai_push.key | ||
# portal.notifications.push.privatekey=another.key | ||
|
||
# To enable push, you need to generate a VAPID keypair. This is the public one. | ||
# | ||
# DEFAULT: sakai_push.key.pub | ||
# portal.notifications.push.publickey=anotherkey.pub | ||
|
||
# The push service at Mozilla requires VAPID signatures, with a sub field. When you generate a | ||
# VAPID keypair, you will use an email as the subject - specify that email here. The email is | ||
# useful as it gives the push service supplier a way of contacting you in case of issues. Google is | ||
# a bit more lenient and doesn't require the sub field to be populated (at the time of writing | ||
# this!). | ||
# | ||
# One of the many services for generating VAPID keypairs: https://vapidkeys.com/ | ||
# | ||
# DEFAULT: "" | ||
# portal.notifications.push.subject=mailto: <[email protected]> | ||
|
||
# ############################################################### | ||
# SAK-43903 Configurable Favicon | ||
# Defaults to /library/icon/favicon.ico | ||
|
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
72 changes: 72 additions & 0 deletions
72
kernel/api/src/main/java/org/sakaiproject/messaging/api/model/PushSubscription.java
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,72 @@ | ||
/** | ||
* Copyright (c) 2003-2019 The Apereo Foundation | ||
* | ||
* Licensed under the Educational Community License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://opensource.org/licenses/ecl2 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.sakaiproject.messaging.api.model; | ||
|
||
import java.time.Instant; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.Entity; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.Index; | ||
import javax.persistence.SequenceGenerator; | ||
import javax.persistence.Table; | ||
import javax.persistence.UniqueConstraint; | ||
|
||
import org.sakaiproject.springframework.data.PersistableEntity; | ||
|
||
import org.hibernate.annotations.Type; | ||
|
||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
|
||
@Entity | ||
@Table(name = "PUSH_SUBSCRIPTIONS", | ||
indexes = { | ||
@Index(name = "IDX_PUSH_SUBSCRIPTIONS_USER", columnList = "USER_ID") | ||
} | ||
) | ||
@Data | ||
@EqualsAndHashCode(onlyExplicitlyIncluded = true) | ||
public class PushSubscription implements PersistableEntity<Long> { | ||
|
||
@Id | ||
@Column(name = "ID", nullable = false) | ||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "push_subscription_id_sequence") | ||
@SequenceGenerator(name = "push_subscription_id_sequence", sequenceName = "PUSH_SUBSCRIPTION_S") | ||
@EqualsAndHashCode.Include | ||
private Long id; | ||
|
||
@Column(name = "USER_ID", length = 99, nullable = false) | ||
private String userId; | ||
|
||
@Column(name = "USER_KEY", length = 255, nullable = false) | ||
private String userKey; | ||
|
||
@Column(name = "AUTH", length = 255, nullable = false) | ||
private String auth; | ||
|
||
@Column(name = "ENDPOINT", length = 255, nullable = false) | ||
private String endpoint; | ||
|
||
@Column(name = "FINGERPRINT", length = 255, nullable = false, unique = true) | ||
private String fingerprint; | ||
|
||
@Type(type = "org.hibernate.type.InstantType") | ||
@Column(name = "CREATED", nullable = false) | ||
private Instant created; | ||
} |
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
29 changes: 29 additions & 0 deletions
29
...i/src/main/java/org/sakaiproject/messaging/api/repository/PushSubscriptionRepository.java
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,29 @@ | ||
/* | ||
* Copyright (c) 2003-2021 The Apereo Foundation | ||
* | ||
* Licensed under the Educational Community License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://opensource.org/licenses/ecl2 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.sakaiproject.messaging.api.repository; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import org.sakaiproject.messaging.api.model.PushSubscription; | ||
|
||
import org.sakaiproject.springframework.data.SpringCrudRepository; | ||
|
||
public interface PushSubscriptionRepository extends SpringCrudRepository<PushSubscription, Long> { | ||
|
||
List<PushSubscription> findByUser(String user); | ||
int deleteByFingerprint(String browserFingerprint); | ||
} |
Oops, something went wrong.