Ejemplo n.º 1
0
        //-------------------------//
        #region Permissões de Acesso ao Sistema

        private Permissao CadastrarProjeto()
        {
            Permissao CadProjRole = ObjectSpace.FindObject <Permissao>(new BinaryOperator("Name", "CadastrarProjeto"));

            if (CadProjRole == null)
            {
                CadProjRole      = ObjectSpace.CreateObject <Permissao>();
                CadProjRole.Name = "CadastrarProjeto";
                CadProjRole.AddObjectPermission <PermissionPolicyUser>(SecurityOperations.Read, "[Oid] = CurrentUserId()", SecurityPermissionState.Allow);
            }
            CadProjRole.PermissionPolicy = SecurityPermissionPolicy.DenyAllByDefault;
            CadProjRole.AddTypePermissionsRecursively <Projeto>("Create;Write;Read", SecurityPermissionState.Allow);
            CadProjRole.AddTypePermissionsRecursively <Tarefa>("Read", SecurityPermissionState.Allow);
            CadProjRole.AddTypePermissionsRecursively <SubTarefa>("Read", SecurityPermissionState.Allow);
            CadProjRole.AddTypePermissionsRecursively <Versao>("Read", SecurityPermissionState.Allow);
            CadProjRole.AddTypePermissionsRecursively <Usuario>("Read", SecurityPermissionState.Allow);

            CadProjRole.AddNavigationPermission(@"Application/NavigationItems/Items/Projetos/Items/Projeto_ListView", SecurityPermissionState.Allow);
            CadProjRole.AddNavigationPermission(@"Application/NavigationItems/Items/Projetos/Items/CriarProjeto_DetailView", SecurityPermissionState.Allow);
            CadProjRole.Save();
            return(CadProjRole);
        }