Ejemplo n.º 1
0
        private void treeView1_DoubleClick(object sender, EventArgs e)
        {
            var resource = (SecurityResourceDto)((TreeView)sender).SelectedNode.Tag;

            if (resource != null)
            {
                if (UserContext.CurrentToken != null)
                {
                    var authResult = presenter.CheckAccess(resource, UserContext.CurrentToken);
                    var userInfo   = UserInfoGenerator.GenerateUserInfo(authResult.AccessToken, UserContext.CurrentToken);
                    if (authResult.AccessToken[1])
                    {
                        MessageBox.Show("has 1 access");
                    }
                    else
                    {
                        MessageBox.Show("has not 1 access");
                    }
                    if (authResult.AccessToken["Insert"])
                    {
                        MessageBox.Show("has insert access");
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void CreateRepository()
        {
            var userInfos = UserInfoGenerator.Generate(0, 0);
            var dataSet   = new CremaDataSet();

            try
            {
                CremaBootstrapper.CreateRepositoryInternal(this.application, this.Path, this.RepositoryModule, this.FileType, this.DataBaseUrl, userInfos, dataSet);
            }
            catch
            {
                if (this.Force == true)
                {
                    DirectoryUtility.Delete(this.Path);
                }
                CremaBootstrapper.CreateRepositoryInternal(this.application, this.Path, this.RepositoryModule, this.FileType, this.DataBaseUrl, userInfos, dataSet);
            }
        }
Ejemplo n.º 3
0
        public async Task InitializeAsync(TestContext context)
        {
            var basePath       = Path.Combine(context.TestRunDirectory, "repo");
            var repositoryPath = GenerateRepositoryPath();
            var userInfos      = UserInfoGenerator.Generate(0, 0);
            var dataSet        = new CremaDataSet();
            await Task.Run(() => CremaBootstrapper.CreateRepositoryInternal(this, repositoryPath, "git", "xml", string.Empty, userInfos, dataSet));

            this.BasePath  = repositoryPath;
            this.LongPaths = Environment.OSVersion.Platform == PlatformID.Win32NT;
            this.cremaHost = this.GetService(typeof(ICremaHost)) as ICremaHost;
            this.context   = context;

            string GenerateRepositoryPath()
            {
                var repositoryPath = Path.Combine(basePath, context.FullyQualifiedTestClassName);

                if (Environment.OSVersion.Platform == PlatformID.Win32NT && repositoryPath.Length > 168)
                {
                    repositoryPath = Path.Combine(basePath, $"{Guid.NewGuid()}");
                }
                return(repositoryPath);
            }
        }