Ejemplo n.º 1
0
        public bool AddRole(string user, string application, string role)
        {
            const string store = "CATS";

            string            connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["CatsContext"].ConnectionString;
            IAzManStorage     storage          = new SqlAzManStorage(connectionString);
            IAzManStore       mystore          = storage.GetStore(store); //or storage["My Store"]
            IAzManApplication myapp            = mystore.GetApplication(application);

            //mystore.GetApplications();
            IAzManItem azManRole = myapp.GetItem(role);

            IAzManAuthorization dele = azManRole.CreateAuthorization(
                mystore.GetDBUser("Admin").CustomSid,
                WhereDefined.Database,
                mystore.GetDBUser(user).CustomSid,
                WhereDefined.Database,
                AuthorizationType.AllowWithDelegation,
                null,
                null
                );

            //IAzManAuthorization del = azManRole.CreateDelegateAuthorization(mystore.GetDBUser("Admin"),mystore.GetDBUser(user).CustomSid,RestrictedAuthorizationType.Allow, null,null);

            return(true);
        }