示例#1
0
        public ImportStatus StartImportFromBasecamp(string url, string token, bool processClosed, bool disableNotifications)
        {
            ProjectSecurity.DemandAuthentication();

            //Validate all data
            if (string.IsNullOrEmpty(url))
            {
                throw new ArgumentException(SettingsResource.EmptyURL);
            }
            if (string.IsNullOrEmpty(token))
            {
                throw new ArgumentException(SettingsResource.EmptyToken);
            }
            if (!Uri.IsWellFormedUriString(url, UriKind.Absolute))
            {
                throw new ArgumentException(SettingsResource.MalformedUrl);
            }
            if (!Regex.IsMatch(url.Trim(), @"^http[s]{0,1}://.+\.basecamphq\.com[/]{0,1}$"))
            {
                throw new ArgumentException(SettingsResource.NotBasecampUrl);
            }

            ImportQueue.Add(url, token, processClosed, disableNotifications);
            return(ImportQueue.GetStatus());
        }
        public ImportStatus Add(string url, string userName, string password, bool importClosed, bool disableNotifications, bool importUsersAsCollaborators, IEnumerable <int> projects)
        {
            if (!CoreContext.UserManager.IsUserInGroup(SecurityContext.CurrentAccount.ID, Core.Users.Constants.GroupAdmin.ID))
            {
                throw new SecurityException();
            }

            //Validate all data
            if (string.IsNullOrEmpty(url))
            {
                throw new ArgumentException(ImportResource.EmptyURL);
            }

            if (string.IsNullOrEmpty(userName))
            {
                throw new ArgumentException(ImportResource.EmptyEmail);
            }

            if (string.IsNullOrEmpty(password))
            {
                throw new ArgumentException(ImportResource.EmptyPassword);
            }

            if (!Uri.IsWellFormedUriString(url, UriKind.Absolute))
            {
                throw new ArgumentException(ImportResource.MalformedUrl);
            }

            ImportQueue.Add(url, userName, password, importClosed, disableNotifications, importUsersAsCollaborators, projects);

            MessageService.Send(Request, MessageAction.ProjectsImportedFromBasecamp, url);

            return(GetStatus());
        }
        public override void EnterImportSpec(GoParser.ImportSpecContext context)
        {
            // Remove quotes from package name
            CurrentImportPath = RemoveSurrounding(ToStringLiteral(context.importPath().string_().GetText()));

            // Add package to import queue
            ImportQueue.Add(CurrentImportPath);
        }