Skip to content
Permalink
Browse files

feat: Invite a user in a group

  • Loading branch information...
aelamrani committed Feb 11, 2019
1 parent 727e5e8 commit 810f82d03dd12a12387373cedfdd31e69022271a
Showing with 1,471 additions and 159 deletions.
  1. +59 −9 gravitee-management-api-model/src/main/java/io/gravitee/management/model/GroupEntity.java
  2. +0 −4 gravitee-management-api-model/src/main/java/io/gravitee/management/model/GroupMemberEntity.java
  3. +133 −0 gravitee-management-api-model/src/main/java/io/gravitee/management/model/InvitationEntity.java
  4. +24 −0 ...itee-management-api-model/src/main/java/io/gravitee/management/model/InvitationReferenceType.java
  5. +56 −4 gravitee-management-api-model/src/main/java/io/gravitee/management/model/NewGroupEntity.java
  6. +107 −0 gravitee-management-api-model/src/main/java/io/gravitee/management/model/NewInvitationEntity.java
  7. +20 −1 gravitee-management-api-model/src/main/java/io/gravitee/management/model/RegisterUserEntity.java
  8. +59 −8 gravitee-management-api-model/src/main/java/io/gravitee/management/model/UpdateGroupEntity.java
  9. +115 −0 gravitee-management-api-model/src/main/java/io/gravitee/management/model/UpdateInvitationEntity.java
  10. +2 −1 ...-management-api-model/src/main/java/io/gravitee/management/model/permissions/GroupPermission.java
  11. +2 −1 ...e-management-api-model/src/main/java/io/gravitee/management/model/permissions/RolePermission.java
  12. +63 −0 ...i-repository/src/main/java/io/gravitee/management/repository/proxy/InvitationRepositoryProxy.java
  13. +120 −0 ...agement-api-rest/src/main/java/io/gravitee/management/rest/resource/GroupInvitationsResource.java
  14. +61 −26 ...-management-api-rest/src/main/java/io/gravitee/management/rest/resource/GroupMembersResource.java
  15. +33 −6 gravitee-management-api-rest/src/main/java/io/gravitee/management/rest/resource/GroupResource.java
  16. +36 −0 gravitee-management-api-service/src/main/java/io/gravitee/management/service/InvitationService.java
  17. +1 −15 gravitee-management-api-service/src/main/java/io/gravitee/management/service/MembershipService.java
  18. +2 −0 gravitee-management-api-service/src/main/java/io/gravitee/management/service/UserService.java
  19. +6 −1 ...nt-api-service/src/main/java/io/gravitee/management/service/builder/EmailNotificationBuilder.java
  20. +38 −0 ...ce/src/main/java/io/gravitee/management/service/exceptions/GroupInvitationForbiddenException.java
  21. +43 −0 .../main/java/io/gravitee/management/service/exceptions/GroupMembersLimitationExceededException.java
  22. +41 −0 ...rc/main/java/io/gravitee/management/service/exceptions/InvitationEmailAlreadyExistsException.java
  23. +34 −0 ...-service/src/main/java/io/gravitee/management/service/exceptions/InvitationNotFoundException.java
  24. +41 −0 ...ce/src/main/java/io/gravitee/management/service/exceptions/MemberEmailAlreadyExistsException.java
  25. +25 −11 ...ee-management-api-service/src/main/java/io/gravitee/management/service/impl/GroupServiceImpl.java
  26. +245 −0 ...nagement-api-service/src/main/java/io/gravitee/management/service/impl/InvitationServiceImpl.java
  27. +16 −19 ...nagement-api-service/src/main/java/io/gravitee/management/service/impl/MembershipServiceImpl.java
  28. +10 −12 ...tee-management-api-service/src/main/java/io/gravitee/management/service/impl/RoleServiceImpl.java
  29. +54 −34 ...tee-management-api-service/src/main/java/io/gravitee/management/service/impl/UserServiceImpl.java
  30. +3 −2 ...-service/src/main/java/io/gravitee/management/service/notification/NotificationParamsBuilder.java
  31. +4 −3 ...-management-api-service/src/main/java/io/gravitee/management/service/notification/PortalHook.java
  32. +3 −2 gravitee-management-api-service/src/test/java/io/gravitee/management/service/UserServiceTest.java
  33. +12 −0 ...gravitee-management-api-standalone-distribution/src/main/resources/templates/groupInvitation.html
  34. +3 −0 ...dalone-distribution/src/main/resources/templates/notifications/portal/PORTAL.GROUP_INVITATION.yml
@@ -33,19 +33,22 @@
private String name;
@JsonProperty("event_rules")
private List<GroupEventRuleEntity> eventRules;

boolean manageable;

/**
* Roles
*/
private Map<RoleScope, String> roles;

@JsonProperty("created_at")
private Date createdAt;

@JsonProperty("updated_at")
private Date updatedAt;
@JsonProperty("max_invitation")
private Integer maxInvitation;
@JsonProperty("lock_api_role")
private boolean lockApiRole;
@JsonProperty("lock_application_role")
private boolean lockApplicationRole;
@JsonProperty("system_invitation")
private boolean systemInvitation;
@JsonProperty("email_invitation")
private boolean emailInvitation;

public String getId() {
return id;
@@ -103,6 +106,46 @@ public void setRoles(Map<RoleScope, String> roles) {
this.roles = roles;
}

public Integer getMaxInvitation() {
return maxInvitation;
}

public void setMaxInvitation(Integer maxInvitation) {
this.maxInvitation = maxInvitation;
}

public boolean isLockApiRole() {
return lockApiRole;
}

public void setLockApiRole(boolean lockApiRole) {
this.lockApiRole = lockApiRole;
}

public boolean isLockApplicationRole() {
return lockApplicationRole;
}

public void setLockApplicationRole(boolean lockApplicationRole) {
this.lockApplicationRole = lockApplicationRole;
}

public boolean isSystemInvitation() {
return systemInvitation;
}

public void setSystemInvitation(boolean systemInvitation) {
this.systemInvitation = systemInvitation;
}

public boolean isEmailInvitation() {
return emailInvitation;
}

public void setEmailInvitation(boolean emailInvitation) {
this.emailInvitation = emailInvitation;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
@@ -121,9 +164,16 @@ public String toString() {
return "GroupEntity{" +
"id='" + id + '\'' +
", name='" + name + '\'' +
", eventRules='" + eventRules + '\'' +
", eventRules=" + eventRules +
", manageable=" + manageable +
", roles=" + roles +
", createdAt=" + createdAt +
", updatedAt=" + updatedAt +
"}";
", maxInvitation=" + maxInvitation +
", lockApiRole=" + lockApiRole +
", lockApplicationRole=" + lockApplicationRole +
", systemInvitation=" + systemInvitation +
", emailInvitation=" + emailInvitation +
'}';
}
}
@@ -36,14 +36,10 @@ public GroupMemberEntity(MemberEntity memberEntity) {
}

private String id;

private String displayName;

private Map<String, String> roles;

@JsonProperty("created_at")
private Date createdAt;

@JsonProperty("updated_at")
private Date updatedAt;

@@ -0,0 +1,133 @@
/**
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
*
* Licensed under the Apache 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://www.apache.org/licenses/LICENSE-2.0
*
* 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 io.gravitee.management.model;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Date;
import java.util.Objects;

/**
* @author Azize ELAMRANI (azize.elamrani at graviteesource.com)
* @author GraviteeSource Team
*/
public class InvitationEntity {
private String id;
@JsonProperty("reference_type")
private InvitationReferenceType referenceType;
@JsonProperty("reference_id")
private String referenceId;
private String email;
@JsonProperty("api_role")
private String apiRole;
@JsonProperty("application_role")
private String applicationRole;
@JsonProperty("created_at")
private Date createdAt;
@JsonProperty("updated_at")
private Date updatedAt;

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

public InvitationReferenceType getReferenceType() {
return referenceType;
}

public void setReferenceType(InvitationReferenceType referenceType) {
this.referenceType = referenceType;
}

public String getReferenceId() {
return referenceId;
}

public void setReferenceId(String referenceId) {
this.referenceId = referenceId;
}

public String getEmail() {
return email;
}

public void setEmail(String email) {
this.email = email;
}

public String getApiRole() {
return apiRole;
}

public void setApiRole(String apiRole) {
this.apiRole = apiRole;
}

public String getApplicationRole() {
return applicationRole;
}

public void setApplicationRole(String applicationRole) {
this.applicationRole = applicationRole;
}

public Date getCreatedAt() {
return createdAt;
}

public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}

public Date getUpdatedAt() {
return updatedAt;
}

public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof InvitationEntity)) return false;
InvitationEntity that = (InvitationEntity) o;
return Objects.equals(id, that.id);
}

@Override
public int hashCode() {
return Objects.hash(id);
}

@Override
public String toString() {
return "InvitationEntity{" +
"id='" + id + '\'' +
", referenceType=" + referenceType +
", referenceId='" + referenceId + '\'' +
", email='" + email + '\'' +
", apiRole='" + apiRole + '\'' +
", applicationRole='" + applicationRole + '\'' +
", createdAt=" + createdAt +
", updatedAt=" + updatedAt +
'}';
}
}
@@ -0,0 +1,24 @@
/**
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
*
* Licensed under the Apache 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://www.apache.org/licenses/LICENSE-2.0
*
* 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 io.gravitee.management.model;

/**
* @author Azize ELAMRANI (azize.elamrani at graviteesource.com)
* @author GraviteeSource Team
*/
public enum InvitationReferenceType {
API, APPLICATION, GROUP
}
@@ -28,9 +28,16 @@

@NotNull
private String name;

@JsonProperty("event_rules")
private List<GroupEventRuleEntity> eventRules;
private Integer maxInvitation;
@JsonProperty("lock_api_role")
private boolean lockApiRole;
@JsonProperty("lock_application_role")
private boolean lockApplicationRole;
private boolean systemInvitation;
@JsonProperty("email_invitation")
private boolean emailInvitation;

public String getName() {
return name;
@@ -48,11 +55,56 @@ public void setEventRules(List<GroupEventRuleEntity> eventRules) {
this.eventRules = eventRules;
}

public Integer getMaxInvitation() {
return maxInvitation;
}

public void setMaxInvitation(Integer maxInvitation) {
this.maxInvitation = maxInvitation;
}

public boolean isLockApiRole() {
return lockApiRole;
}

public void setLockApiRole(boolean lockApiRole) {
this.lockApiRole = lockApiRole;
}

public boolean isLockApplicationRole() {
return lockApplicationRole;
}

public void setLockApplicationRole(boolean lockApplicationRole) {
this.lockApplicationRole = lockApplicationRole;
}

public boolean isSystemInvitation() {
return systemInvitation;
}

public void setSystemInvitation(boolean systemInvitation) {
this.systemInvitation = systemInvitation;
}

public boolean isEmailInvitation() {
return emailInvitation;
}

public void setEmailInvitation(boolean emailInvitation) {
this.emailInvitation = emailInvitation;
}

@Override
public String toString() {
return "NewGroupEntity{" +
", name='" + name + '\'' +
", eventRules='" + eventRules + '\'' +
"}";
"name='" + name + '\'' +
", eventRules=" + eventRules +
", maxInvitation=" + maxInvitation +
", lockApiRole=" + lockApiRole +
", lockApplicationRole=" + lockApplicationRole +
", systemInvitation=" + systemInvitation +
", emailInvitation=" + emailInvitation +
'}';
}
}
Oops, something went wrong.

0 comments on commit 810f82d

Please sign in to comment.
You can’t perform that action at this time.