Beispiel #1
0
        public virtual async Task <IScimResponse <Unit> > DeleteUser(string userId)
        {
            var exists = await _UserRepository.UserExists(userId);

            if (!exists)
            {
                return(new ScimErrorResponse <Unit>(
                           new ScimError(
                               HttpStatusCode.NotFound,
                               detail: ScimErrorDetail.NotFound(userId))));
            }

            await _UserRepository.DeleteUser(userId);

            return(new ScimDataResponse <Unit>(default(Unit)));
        }
Beispiel #2
0
        public virtual async Task <IScimResponse <Unit> > DeleteGroup(string groupId)
        {
            var groupExists = await _GroupRepository.GroupExists(groupId);

            if (!groupExists)
            {
                return(new ScimErrorResponse <Unit>(
                           new ScimError(
                               HttpStatusCode.NotFound,
                               detail: ScimErrorDetail.NotFound(groupId))));
            }

            await _GroupRepository.DeleteGroup(groupId);

            return(new ScimDataResponse <Unit>(default(Unit)));
        }
Beispiel #3
0
        public virtual async Task <IScimResponse <ScimGroup> > RetrieveGroup(string groupId)
        {
            var userRecord = SetResourceVersion(await _GroupRepository.GetGroup(groupId));

            if (userRecord == null)
            {
                return(new ScimErrorResponse <ScimGroup>(
                           new ScimError(
                               HttpStatusCode.NotFound,
                               detail: ScimErrorDetail.NotFound(groupId))));
            }

            // repository populates meta only if it sets Created and/or LastModified
            if (userRecord.Meta == null)
            {
                userRecord.Meta = new ResourceMetadata(ScimConstants.ResourceTypes.Group);
            }

            return(new ScimDataResponse <ScimGroup>(userRecord));
        }
Beispiel #4
0
        public virtual async Task <IScimResponse <ScimUser> > RetrieveUser(string userId)
        {
            var userRecord = await _UserRepository.GetUser(userId);

            if (userRecord == null)
            {
                return(new ScimErrorResponse <ScimUser>(
                           new ScimError(
                               HttpStatusCode.NotFound,
                               detail: ScimErrorDetail.NotFound(userId))));
            }

            // repository populates meta only if it sets Created and/or LastModified
            if (userRecord.Meta == null)
            {
                userRecord.Meta = new ResourceMetadata(ScimConstants.ResourceTypes.User);
            }

            SetResourceVersion(userRecord);

            return(new ScimDataResponse <ScimUser>(userRecord));
        }