Skip to content
This repository has been archived by the owner on Jul 29, 2021. It is now read-only.

feat(user): add user management #66

Merged
merged 1 commit into from Apr 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -91,6 +91,15 @@ public interface MembershipRepository {
*/
Set<Membership> findByUserAndReferenceType(String userId, MembershipReferenceType referenceType) throws TechnicalException;

/**
* find all memberships for a role
* @param roleScope the role
* @param roleName the role
* @return the list of memberships, or an empty set
* @throws TechnicalException if something goes wrong, should never happen.
*/
Set<Membership> findByRole(RoleScope roleScope, String roleName) throws TechnicalException;

/**
* find all memberships for a user, a referenceType and a membership type
* => find all apis of a user where he is a primary owner
Expand All @@ -102,4 +111,12 @@ public interface MembershipRepository {
* @throws TechnicalException if something goes wrong, should never happen.
*/
Set<Membership> findByUserAndReferenceTypeAndRole(String userId, MembershipReferenceType referenceType, RoleScope roleScope, String roleName) throws TechnicalException;

/**
* find all memberships for a user
* @param userId the user
* @return the list of memberships, or an empty set
* @throws TechnicalException if something goes wrong, should never happen.
*/
Set<Membership> findByUser(String userId) throws TechnicalException;
}
Expand Up @@ -15,7 +15,9 @@
*/
package io.gravitee.repository.management.api;

import io.gravitee.common.data.domain.Page;
import io.gravitee.repository.exceptions.TechnicalException;
import io.gravitee.repository.management.api.search.Pageable;
import io.gravitee.repository.management.model.User;

import java.util.List;
Expand All @@ -27,25 +29,7 @@
* @author Nicolas GERAUD (nicolas.geraud at graviteesource.com)
* @author GraviteeSource Team
*/
public interface UserRepository {

Optional<User> findById(String id) throws TechnicalException;

/**
* Create a {@link User}
*
* @param user user to create
* @return User created
*/
User create(User user) throws TechnicalException;

/**
* Update a {@link User}
*
* @param user user to update
* @return User updated
*/
User update(User user) throws TechnicalException;
public interface UserRepository extends CrudRepository<User, String> {

/**
* Find a {@link User} by name
Expand All @@ -63,9 +47,9 @@ public interface UserRepository {
Set<User> findByIds(List<String> ids) throws TechnicalException;

/**
* Find all {@link User}s
* search {@link User}s
*
* @return Users found
*/
Set<User> findAll() throws TechnicalException;
Page<User> search(Pageable pageable) throws TechnicalException;
}