<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Security;
using System.Web.Http;
using Core.DomainModel;
using Core.DomainModel.ItProject;
using Core.DomainModel.ItSystem;
using Core.DomainServices;
using UI.MVC4.Models;

namespace UI.MVC4.Controllers.API
{
    public class ItProjectController : GenericApiController<ItProject, int, ItProjectDTO>
    {
        private readonly IItProjectService _itProjectService;
        private readonly IGenericRepository<TaskRef> _taskRepository;
        private readonly IGenericRepository<ItSystemUsage> _itSystemUsageRepository;
        private readonly IGenericRepository<Organization> _orgRepository;
        private readonly IGenericRepository<OrganizationUnit> _orgUnitRepository;

        public ItProjectController(IGenericRepository<ItProject> repository, IItProjectService itProjectService, IGenericRepository<Organization> orgRepository, IGenericRepository<OrganizationUnit> orgUnitRepository, IGenericRepository<TaskRef> taskRepository, IGenericRepository<ItSystemUsage> itSystemUsageRepository) 
            : base(repository)
        {
            _itProjectService = itProjectService;
            _orgRepository = orgRepository;
            _taskRepository = taskRepository;
            _itSystemUsageRepository = itSystemUsageRepository;
            _orgUnitRepository = orgUnitRepository;
        }

        public HttpResponseMessage GetHasWriteAccess(int id, bool? hasWriteAccess)
        {
            try
            {
                var project = Repository.GetByKey(id);
                return Ok(_itProjectService.HasWriteAccess(KitosUser, project));
            }
            catch (Exception e)
            {
                return Error(e);
            }
        }

        public HttpResponseMessage GetPublic()
        {
            try
            {
                var projects = _itProjectService.GetAll();

                return Ok(Map(projects));<commit_msg>Removed unused ctrl action which caused issues. Removed unsued repo from ctor args.<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Security;
using System.Web.Http;
using Core.DomainModel;
using Core.DomainModel.ItProject;
using Core.DomainModel.ItSystem;
using Core.DomainServices;
using UI.MVC4.Models;

namespace UI.MVC4.Controllers.API
{
    public class ItProjectController : GenericApiController<ItProject, int, ItProjectDTO>
    {
        private readonly IItProjectService _itProjectService;
        private readonly IGenericRepository<TaskRef> _taskRepository;
        private readonly IGenericRepository<ItSystemUsage> _itSystemUsageRepository;
        private readonly IGenericRepository<OrganizationUnit> _orgUnitRepository;

        public ItProjectController(IGenericRepository<ItProject> repository, IItProjectService itProjectService, IGenericRepository<OrganizationUnit> orgUnitRepository, IGenericRepository<TaskRef> taskRepository, IGenericRepository<ItSystemUsage> itSystemUsageRepository) 
            : base(repository)
        {
            _itProjectService = itProjectService;
            _taskRepository = taskRepository;
            _itSystemUsageRepository = itSystemUsageRepository;
            _orgUnitRepository = orgUnitRepository;
        }

        public HttpResponseMessage GetHasWriteAccess(int id, bool? hasWriteAccess)
        {
            try
            {
                var project = Repository.GetByKey(id);
                return Ok(_itProjectService.HasWriteAccess(KitosUser, project));
{'fraction_non_alphanumeric': 0.06237870806764624, 'fraction_numerical': 0.0011089548100914888, 'mean_word_length': 3.3157894736842106, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2226809', 'n_tokens_mistral': 879, 'n_tokens_neox': 869, 'n_words': 191}