public IActionResult Delete([FromQuery] string name)
        {
            if (!_currentUser.HasRole(Permission.UserAccountAdmin))
            {
                return(Forbidden());
            }

            _logger.LogInformation("Removing user group: {0}", name);

            // determine whether specified user group is related to a system group or not. Deleting one of system group is not allowed
            if (EnumInfo.GetList <SystemUserGroup>().Any(systemUserGroup => systemUserGroup.Name.ToUpper() == name.ToUpper()))
            {
                return(Error("Removing a system user group is not permitted"));
            }

            Maybe <AppGroup> userGroup = _groupRepo.FindByName(name);

            if (userGroup.HasNoValue)
            {
                return(Error($"No matching user group found: {name}"));
            }

            // remove user groups and their aggregates
            _groupRepo.Delete(userGroup.Value.Id);

            return(Ok("User group removed"));
        }
Esempio n. 2
0
        public AppGroup Delete(int id)
        {
            var appGroup = this._appGroupRepository.GetSingleById(id);

            return(_appGroupRepository.Delete(appGroup));
        }
Esempio n. 3
0
        public AppGroup Delete(int id)
        {
            var appGroup = this._appGroupRepo.Table.FirstOrDefault(x => x.Id == id);

            return(_appGroupRepo.Delete(appGroup));
        }